1 /*=============================================================================
2     Copyright (c) 2003 Martin Wille
3     http://spirit.sourceforge.net/
4 
5     Use, modification and distribution is subject to the Boost Software
6     License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7     http://www.boost.org/LICENSE_1_0.txt)
8 =============================================================================*/
9 #include <boost/config.hpp>
10 
11 ///////////////////////////////////////////////////////////////////////////
12 // workaround for prestandard support of stringstreams
13 //
14 // * defines sstream_t for the string stream type
15 // * defines std::string getstring(sstream_t &);
16 //
17 
18 #ifdef BOOST_NO_STRINGSTREAM
19 #   include <strstream>
20     typedef strstream sstream_t;
21     std::string
getstring(std::strstream & ss)22     getstring(std::strstream& ss)
23     {
24         ss << ends;
25         std::string rval = ss.str();
26         ss.freeze(false);
27         return rval;
28     }
29 #else
30 #   include <sstream>
31     typedef std::stringstream sstream_t;
32     std::string
getstring(std::stringstream & ss)33     getstring(std::stringstream &ss)
34     {
35         return ss.str();
36     }
37 #endif
38 
use_getstring_to_avoid_compiler_warnings_about_unused_functions()39 void use_getstring_to_avoid_compiler_warnings_about_unused_functions()
40 {
41     sstream_t ss;
42     getstring(ss);
43     if(!ss) { // to be not recursive on all control paths
44         use_getstring_to_avoid_compiler_warnings_about_unused_functions();
45     }
46 }
47