github.com/searKing/golang/go@v1.2.117/runtime/cgosymbolizer/include/boost/stacktrace/frame.hpp (about) 1 // Copyright Antony Polukhin, 2016-2020. 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/core/explicit_operator_bool.hpp> 19 20 #include <boost/stacktrace/safe_dump_to.hpp> // boost::stacktrace::detail::native_frame_ptr_t 21 22 #include <boost/stacktrace/detail/frame_decl.hpp> 23 #include <boost/stacktrace/detail/push_options.h> 24 25 namespace boost { namespace stacktrace { 26 27 /// Comparison operators that provide platform dependant ordering and have O(1) complexity; are Async-Handler-Safe. 28 BOOST_CONSTEXPR inline bool operator< (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() < rhs.address(); } 29 BOOST_CONSTEXPR inline bool operator> (const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return rhs < lhs; } 30 BOOST_CONSTEXPR inline bool operator<=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs > rhs); } 31 BOOST_CONSTEXPR inline bool operator>=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs < rhs); } 32 BOOST_CONSTEXPR inline bool operator==(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return lhs.address() == rhs.address(); } 33 BOOST_CONSTEXPR inline bool operator!=(const frame& lhs, const frame& rhs) BOOST_NOEXCEPT { return !(lhs == rhs); } 34 35 /// Fast hashing support, O(1) complexity; Async-Handler-Safe. 36 inline std::size_t hash_value(const frame& f) BOOST_NOEXCEPT { 37 return reinterpret_cast<std::size_t>(f.address()); 38 } 39 40 /// Outputs stacktrace::frame in a human readable format to string; unsafe to use in async handlers. 41 BOOST_STACKTRACE_FUNCTION std::string to_string(const frame& f); 42 43 /// Outputs stacktrace::frame in a human readable format to output stream; unsafe to use in async handlers. 44 template <class CharT, class TraitsT> 45 std::basic_ostream<CharT, TraitsT>& operator<<(std::basic_ostream<CharT, TraitsT>& os, const frame& f) { 46 return os << boost::stacktrace::to_string(f); 47 } 48 49 }} // namespace boost::stacktrace 50 51 /// @cond 52 53 #include <boost/stacktrace/detail/pop_options.h> 54 55 #ifndef BOOST_STACKTRACE_LINK 56 # if defined(BOOST_STACKTRACE_USE_NOOP) 57 # include <boost/stacktrace/detail/frame_noop.ipp> 58 # elif defined(BOOST_MSVC) || defined(BOOST_STACKTRACE_USE_WINDBG) || defined(BOOST_STACKTRACE_USE_WINDBG_CACHED) 59 # include <boost/stacktrace/detail/frame_msvc.ipp> 60 # else 61 # include <boost/stacktrace/detail/frame_unwind.ipp> 62 # endif 63 #endif 64 /// @endcond 65 66 67 #endif // BOOST_STACKTRACE_FRAME_HPP