Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


Copyright (c) 2007-2009: Joachim Faulhaber
Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin
   Distributed under the Boost Software License, Version 1.0.
      (See accompanying file LICENCE.txt or copy at

Function-templates for discrete Datatypes like int, unsigned or
    any class that provides a ++ operator c.f. iterators


#include <stdio.h>
#include <string>
#include <sstream>

namespace boost{ namespace icl

/// Static class template for the string representation of values
template <class Type>
struct to_string
    /** Converts all values of types to std::string that implement an operator << */
    static std::string apply(const Type& value)
        std::stringstream repr;
        repr << value;
        return repr.str();

}} // namespace boost icl