|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75465 - in trunk/boost/chrono: . io io/utility
From: vicente.botet_at_[hidden]
Date: 2011-11-12 13:48:37
Author: viboes
Date: 2011-11-12 13:48:36 EST (Sat, 12 Nov 2011)
New Revision: 75465
URL: http://svn.boost.org/trac/boost/changeset/75465
Log:
Chrono: Added to_string utility
Added:
trunk/boost/chrono/io/utility/to_string.hpp (contents, props changed)
Text files modified:
trunk/boost/chrono/chrono_io.hpp | 3 +++
trunk/boost/chrono/io/ios_base_state.hpp | 4 ++--
2 files changed, 5 insertions(+), 2 deletions(-)
Modified: trunk/boost/chrono/chrono_io.hpp
==============================================================================
--- trunk/boost/chrono/chrono_io.hpp (original)
+++ trunk/boost/chrono/chrono_io.hpp 2011-11-12 13:48:36 EST (Sat, 12 Nov 2011)
@@ -20,4 +20,7 @@
#else
#include <boost/chrono/io_v1/chrono_io.hpp>
#endif
+
+#include <boost/chrono/io/utility/to_string.hpp>
+
#endif // BOOST_CHRONO_CHRONO_IO_HPP
Modified: trunk/boost/chrono/io/ios_base_state.hpp
==============================================================================
--- trunk/boost/chrono/io/ios_base_state.hpp (original)
+++ trunk/boost/chrono/io/ios_base_state.hpp 2011-11-12 13:48:36 EST (Sat, 12 Nov 2011)
@@ -108,8 +108,8 @@
xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<char> > > ios_base_data_aux_xalloc_key_initializer;
xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<wchar_t> > > wios_base_data_aux_xalloc_key_initializer;
#if BOOST_CHRONO_HAS_UNICODE_SUPPORT
- xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<char16_t> > > c16_ios_base_data_aux_xalloc_key_initializer;
- xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<char32_t> > > ios_base_data_aux_xalloc_key_initializer;
+ xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<char16_t> > > u16ios_base_data_aux_xalloc_key_initializer;
+ xalloc_key_initializer_t<ios_base_state<detail::ios_base_data_aux<char32_t> > > u32ios_base_data_aux_xalloc_key_initializer;
#endif
} // namespace
} // namespace detail
Added: trunk/boost/chrono/io/utility/to_string.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/chrono/io/utility/to_string.hpp 2011-11-12 13:48:36 EST (Sat, 12 Nov 2011)
@@ -0,0 +1,48 @@
+// boost/chrono/utility/to_string.hpp
+//
+// Copyright 2011 Vicente J. Botet Escriba
+// Use, modification and distribution are subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt).
+
+#ifndef BOOST_CHRONO_UTILITY_TO_STRING_HPP
+#define BOOST_CHRONO_UTILITY_TO_STRING_HPP
+
+#include <boost/chrono/config.hpp>
+#include <string>
+#include <sstream>
+
+namespace boost
+{
+ namespace chrono
+ {
+ template <typename CharT, typename T>
+ std::basic_string<CharT> to_basic_string(T const&v) {
+ std::basic_stringstream<CharT> sstr;
+ sstr << v;
+ return sstr.str();
+ }
+
+ template <typename T>
+ std::string to_string(T const&v) {
+ return to_basic_string<char>(v);
+ }
+ template <typename T>
+ std::wstring to_wstring(T const&v) {
+ return to_basic_string<wchar_t>(v);
+ }
+#if BOOST_CHRONO_HAS_UNICODE_SUPPORT
+ template <typename T>
+ std::wstring to_u16string(T const&v) {
+ return to_basic_string<char16_t>(v);
+ }
+ template <typename T>
+ std::wstring to_u32string(T const&v) {
+ return to_basic_string<char32_t>(v);
+ }
+#endif
+ } // chrono
+
+} // boost
+
+#endif // header
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk