File indexing completed on 2025-01-18 09:53:14
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_UNITS_UTILITY_HPP
0012 #define BOOST_UNITS_UTILITY_HPP
0013
0014 #include <typeinfo>
0015 #include <string>
0016 #include <boost/core/demangle.hpp>
0017
0018 namespace boost {
0019
0020 namespace units {
0021
0022 namespace detail {
0023
0024 inline
0025 std::string
0026 demangle(const char* name)
0027 {
0028 std::string demangled = core::demangle(name);
0029
0030 const std::string::size_type prefix_len = sizeof("boost::units::") - 1;
0031 std::string::size_type i = 0;
0032 for (;;)
0033 {
0034 std::string::size_type pos = demangled.find("boost::units::", i, prefix_len);
0035 if (pos == std::string::npos)
0036 break;
0037
0038 demangled.erase(pos, prefix_len);
0039 i = pos;
0040 }
0041
0042 return demangled;
0043 }
0044
0045 }
0046
0047 template<class L>
0048 inline std::string simplify_typename(const L& )
0049 {
0050 return detail::demangle(typeid(L).name());
0051 }
0052
0053 }
0054
0055 }
0056
0057 #endif