is_output_streamable.hpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef UUID_898984B4076411DD973EDFA055D89593
  5. #define UUID_898984B4076411DD973EDFA055D89593
  6. #include <ostream>
  7. #if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  8. #pragma GCC system_header
  9. #endif
  10. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  11. #pragma warning(push,1)
  12. #endif
  13. namespace
  14. boost
  15. {
  16. namespace
  17. to_string_detail
  18. {
  19. struct
  20. partial_ordering_helper1
  21. {
  22. template <class CharT,class Traits>
  23. partial_ordering_helper1( std::basic_ostream<CharT,Traits> & );
  24. };
  25. struct
  26. partial_ordering_helper2
  27. {
  28. template <class T>
  29. partial_ordering_helper2( T const & );
  30. };
  31. char operator<<( partial_ordering_helper1, partial_ordering_helper2 );
  32. template <class T,class CharT,class Traits>
  33. struct
  34. is_output_streamable_impl
  35. {
  36. static std::basic_ostream<CharT,Traits> & f();
  37. static T const & g();
  38. enum e { value=1!=(sizeof(f()<<g())) };
  39. };
  40. }
  41. template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
  42. struct
  43. is_output_streamable
  44. {
  45. enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
  46. };
  47. }
  48. #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
  49. #pragma warning(pop)
  50. #endif
  51. #endif