Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:46

0001 //  boost/chrono/utility/to_string.hpp
0002 //
0003 //  Copyright 2011 Vicente J. Botet Escriba
0004 //  Use, modification and distribution are subject to the Boost Software License,
0005 //  Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0006 //  http://www.boost.org/LICENSE_1_0.txt).
0007 
0008 #ifndef BOOST_CHRONO_UTILITY_TO_STRING_HPP
0009 #define BOOST_CHRONO_UTILITY_TO_STRING_HPP
0010 
0011 #include <boost/chrono/config.hpp>
0012 #include <string>
0013 #include <sstream>
0014 
0015 namespace boost
0016 {
0017   namespace chrono
0018   {
0019     template <typename CharT, typename T>
0020     std::basic_string<CharT> to_basic_string(T const&v) {
0021       std::basic_stringstream<CharT> sstr;
0022       sstr << v;
0023       return sstr.str();
0024     }
0025 
0026     template <typename T>
0027     std::string to_string(T const&v) {
0028       return to_basic_string<char>(v);
0029     }
0030 #ifndef BOOST_NO_STD_WSTRING
0031     template <typename T>
0032     std::wstring to_wstring(T const&v) {
0033       return to_basic_string<wchar_t>(v);
0034     }
0035 #endif
0036 #if BOOST_CHRONO_HAS_UNICODE_SUPPORT
0037     template <typename T>
0038     std::basic_string<char16_t> to_u16string(T const&v) {
0039       return to_basic_string<char16_t>(v);
0040     }
0041     template <typename T>
0042     std::basic_string<char32_t> to_u32string(T const&v) {
0043       return to_basic_string<char32_t>(v);
0044     }
0045 #endif
0046   } // chrono
0047 
0048 } // boost
0049 
0050 #endif  // header