Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:14

0001 // Boost.Units - A C++ library for zero-overhead dimensional analysis and 
0002 // unit/quantity manipulation and conversion
0003 //
0004 // Copyright (C) 2003-2008 Matthias Christian Schabel
0005 // Copyright (C) 2008 Steven Watanabe
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See
0008 // accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
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 } // namespace detail
0046 
0047 template<class L>
0048 inline std::string simplify_typename(const L& /*source*/)
0049 {
0050     return detail::demangle(typeid(L).name());
0051 }
0052 
0053 } // namespace units
0054 
0055 } // namespace boost
0056 
0057 #endif // BOOST_UNITS_UTILITY_HPP