is_output_streamable.hpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. namespace
  8. boost
  9. {
  10. namespace
  11. to_string_detail
  12. {
  13. template <class T,class CharT,class Traits>
  14. char operator<<( std::basic_ostream<CharT,Traits> &, T const & );
  15. template <class T,class CharT,class Traits>
  16. struct
  17. is_output_streamable_impl
  18. {
  19. static std::basic_ostream<CharT,Traits> & f();
  20. static T const & g();
  21. enum e { value=1!=(sizeof(f()<<g())) };
  22. };
  23. }
  24. template <class T, class CharT=char, class Traits=std::char_traits<CharT> >
  25. struct
  26. is_output_streamable
  27. {
  28. enum e { value=to_string_detail::is_output_streamable_impl<T,CharT,Traits>::value };
  29. };
  30. }
  31. #endif