msvc_disambiguater.hpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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(__DECCXX_VER, BOOST_TESTED_AT(60590042))
  13. #include <boost/format/group.hpp>
  14. #include <ostream>
  15. namespace boost {
  16. namespace io {
  17. namespace detail {
  18. template< class Ch, class Tr, class T >
  19. struct disambiguater
  20. {
  21. template< typename U >
  22. static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
  23. {
  24. os << group_head(x.a1_);
  25. }
  26. static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
  27. {
  28. }
  29. template< typename U >
  30. static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long)
  31. {
  32. os << group_last(x.a1_);
  33. }
  34. static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int)
  35. {
  36. os << x;
  37. }
  38. };
  39. } // namespace detail
  40. } // namespace io
  41. } // namespace boost
  42. #endif // -__DECCXX_VER
  43. #endif // -BOOST_MSVC_DISAMBIGUATER_HPP