msvc_disambiguater.hpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // ----------------------------------------------------------------------------
  2. // msvc_disambiguater.hpp : msvc workarounds. (for put_{head|last} overloads)
  3. // the trick was described in boost's list by Aleksey Gurtovoy
  4. // ----------------------------------------------------------------------------
  5. // Copyright Samuel Krempp 2003. Use, modification, and distribution are
  6. // subject to the Boost Software License, Version 1.0. (See accompanying
  7. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  8. // see http://www.boost.org/libs/format for library home page
  9. // ----------------------------------------------------------------------------
  10. #ifndef BOOST_MSVC_DISAMBIGUATER_HPP
  11. #define BOOST_MSVC_DISAMBIGUATER_HPP
  12. #if BOOST_WORKAROUND( BOOST_MSVC, <= 1300) || \
  13. BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
  14. // this whole header is specifically for msvc up to 7.0
  15. #include <boost/format/group.hpp>
  16. #include <ostream>
  17. namespace boost {
  18. namespace io {
  19. namespace detail {
  20. template< class Ch, class Tr, class T >
  21. struct disambiguater
  22. {
  23. template< typename U >
  24. static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
  25. {
  26. os << group_head(x.a1_);
  27. }
  28. static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
  29. {
  30. }
  31. template< typename U >
  32. static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
  33. {
  34. os << group_last(x.a1_);
  35. }
  36. static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
  37. {
  38. os << x;
  39. }
  40. };
  41. } // namespace detail
  42. } // namespace io
  43. } // namespace boost
  44. #endif // -BOOST_MSVC
  45. #endif // -BOOST_MSVC_DISAMBIGUATER_HPP