]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*-----------------------------------------------------------------------------+ |
2 | Copyright (c) 2007-2009: Joachim Faulhaber | |
3 | +------------------------------------------------------------------------------+ | |
4 | Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin | |
5 | +------------------------------------------------------------------------------+ | |
6 | Distributed under the Boost Software License, Version 1.0. | |
7 | (See accompanying file LICENCE.txt or copy at | |
8 | http://www.boost.org/LICENSE_1_0.txt) | |
9 | +-----------------------------------------------------------------------------*/ | |
10 | ||
11 | /*----------------------------------------------------------------------------- | |
12 | Function-templates for discrete Datatypes like int, unsigned or | |
13 | any class that provides a ++ operator c.f. iterators | |
14 | -----------------------------------------------------------------------------*/ | |
15 | ||
16 | #ifndef BOOST_ICL_TO_STRING_HPP_JOFA_000712 | |
17 | #define BOOST_ICL_TO_STRING_HPP_JOFA_000712 | |
18 | ||
19 | #include <stdio.h> | |
20 | #include <string> | |
21 | #include <sstream> | |
22 | ||
23 | namespace boost{ namespace icl | |
24 | { | |
25 | ||
26 | /// Static class template for the string representation of values | |
27 | template <class Type> | |
28 | struct to_string | |
29 | { | |
30 | /** Converts all values of types to std::string that implement an operator << */ | |
31 | static std::string apply(const Type& value) | |
32 | { | |
33 | std::stringstream repr; | |
34 | repr << value; | |
35 | return repr.str(); | |
36 | } | |
37 | }; | |
38 | ||
39 | }} // namespace boost icl | |
40 | ||
41 | #endif | |
42 | ||
43 |