has_to_string_test.cpp 999 B

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