is_output_streamable.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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