1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
2 // unit/quantity manipulation and conversion
4 // Copyright (C) 2003-2008 Matthias Christian Schabel
5 // Copyright (C) 2008 Steven Watanabe
7 // Distributed under the Boost Software License, Version 1.0. (See
8 // accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_UNITS_UTILITY_HPP
12 #define BOOST_UNITS_UTILITY_HPP
16 #include <boost/core/demangle.hpp>
26 demangle(const char* name)
28 std::string demangled = core::demangle(name);
30 const std::string::size_type prefix_len = sizeof("boost::units::") - 1;
31 std::string::size_type i = 0;
34 std::string::size_type pos = demangled.find("boost::units::", i, prefix_len);
35 if (pos == std::string::npos)
38 demangled.erase(pos, prefix_len);
48 inline std::string simplify_typename(const L& /*source*/)
50 return detail::demangle(typeid(L).name());
57 #endif // BOOST_UNITS_UTILITY_HPP