github.com/searKing/golang/go@v1.2.117/os/signal/cgo/include/boost/stacktrace/frame.hpp (about)

     1  // Copyright Antony Polukhin, 2016-2023.
     2  //
     3  // Distributed under the Boost Software License, Version 1.0. (See
     4  // accompanying file LICENSE_1_0.txt or copy at
     5  // http://www.boost.org/LICENSE_1_0.txt)
     6  
     7  #ifndef BOOST_STACKTRACE_FRAME_HPP
     8  #define BOOST_STACKTRACE_FRAME_HPP
     9  
    10  #include <boost/config.hpp>
    11  #ifdef BOOST_HAS_PRAGMA_ONCE
    12  #   pragma once
    13  #endif
    14  
    15  #include <iosfwd>
    16  #include <string>
    17  
    18  #include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t
    19  
    20  #include <boost/stacktrace/detail/frame_decl.hpp>
    21  #include <boost/stacktrace/detail/push_options.h>
    22  
    23  namespace boost { namespace stacktrace {
    24  
    25  /// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe.
    26  constexpr inline bool operator< (const frame& lhs, const frame& rhs) noexcept { return lhs.address() < rhs.address(); }
    27  constexpr inline bool operator> (const frame& lhs, const frame& rhs) noexcept { return rhs < lhs; }
    28  constexpr inline bool operator<=(const frame& lhs, const frame& rhs) noexcept { return !(lhs > rhs); }
    29  constexpr inline bool operator>=(const frame& lhs, const frame& rhs) noexcept { return !(lhs < rhs); }
    30  constexpr inline bool operator==(const frame& lhs, const frame& rhs) noexcept { return lhs.address() == rhs.address(); }
    31  constexpr inline bool operator!=(const frame& lhs, const frame& rhs) noexcept { return !(lhs == rhs); }
    32  
    33  /// Fast hashing support, O(1) complexity; Async-Handler-Safe.
    34  inline std::size_t hash_value(const frame& f) noexcept {
    35      return reinterpret_cast<std::size_t>(f.address());
    36  }
    37  
    38  /// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers.
    39  BOOST_STACKTRACE_FUNCTION std::string to_string(const frame& f);
    40  
    41  /// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers.
    42  template <class CharT, class TraitsT>
    43  std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const frame& f) {
    44      return os << boost::stacktrace::to_string(f);
    45  }
    46  
    47  }} // namespace boost::stacktrace
    48  
    49  /// @cond
    50  
    51  #include <boost/stacktrace/detail/pop_options.h>
    52  
    53  #ifndef BOOST_STACKTRACE_LINK
    54  #   if defined(BOOST_STACKTRACE_USE_NOOP)
    55  #       include <boost/stacktrace/detail/frame_noop.ipp>
    56  #   elif defined(BOOST_MSVC) || defined(BOOST_STACKTRACE_USE_WINDBG) || defined(BOOST_STACKTRACE_USE_WINDBG_CACHED)
    57  #       include <boost/stacktrace/detail/frame_msvc.ipp>
    58  #   else
    59  #       include <boost/stacktrace/detail/frame_unwind.ipp>
    60  #   endif
    61  #endif
    62  /// @endcond
    63  
    64  
    65  #endif // BOOST_STACKTRACE_FRAME_HPP