1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. 2 3 //Distributed under the Boost Software License, Version 1.0. (See accompanying 4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include <boost/exception/to_string.hpp> 7 #include <boost/detail/lightweight_test.hpp> 8 9 namespace 10 n1 11 { 12 struct 13 c1 14 { 15 }; 16 } 17 18 namespace 19 n2 20 { 21 struct 22 c2 23 { 24 }; 25 26 std::string to_string(c2 const &)27 to_string( c2 const & ) 28 { 29 return "c2"; 30 } 31 } 32 33 namespace 34 n3 35 { 36 struct 37 c3 38 { 39 }; 40 41 std::ostream & operator <<(std::ostream & s,c3 const &)42 operator<<( std::ostream & s, c3 const & ) 43 { 44 return s << "c3"; 45 } 46 } 47 48 int main()49main() 50 { 51 using namespace boost; 52 BOOST_TEST( !has_to_string<n1::c1>::value ); 53 BOOST_TEST( has_to_string<n2::c2>::value ); 54 BOOST_TEST( has_to_string<n3::c3>::value ); 55 BOOST_TEST( has_to_string<int>::value ); 56 return boost::report_errors(); 57 } 58