is_output_streamable.hpp 1.7 KB

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