1 // (C) Copyright Gennadiy Rozental 2001.
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 // See http://www.boost.org/libs/test for the library home page.
10 // Version : $Revision$
12 // Description : trivial utility to cast to/from strings
13 // ***************************************************************************
15 #ifndef BOOST_TEST_UTILS_STRING_CAST_HPP
16 #define BOOST_TEST_UTILS_STRING_CAST_HPP
19 #include <boost/test/utils/basic_cstring/basic_cstring.hpp>
24 #include <boost/test/detail/suppress_warnings.hpp>
26 //____________________________________________________________________________//
32 // ************************************************************************** //
33 // ************** string_cast ************** //
34 // ************************************************************************** //
38 string_cast( T const& t )
40 std::ostringstream buff;
45 //____________________________________________________________________________//
47 // ************************************************************************** //
48 // ************** string_as ************** //
49 // ************************************************************************** //
53 string_as( const_string str, T& res )
55 std::istringstream buff( std::string( str.begin(), str.end() ) );
58 return !buff.fail() && buff.eof();
61 //____________________________________________________________________________//
64 } // namespace unit_test
67 #include <boost/test/detail/enable_warnings.hpp>
69 #endif // BOOST_TEST_UTILS_STRING_CAST_HPP