| 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 | |
| 6 | // Copyright Samuel Krempp 2003. Use, modification, and distribution are |
| 7 | // subject to the Boost Software License, Version 1.0. (See accompanying |
| 8 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 9 | |
| 10 | // see http://www.boost.org/libs/format for library home page |
| 11 | |
| 12 | // ---------------------------------------------------------------------------- |
| 13 | |
| 14 | #ifndef BOOST_MSVC_DISAMBIGUATER_HPP |
| 15 | #define BOOST_MSVC_DISAMBIGUATER_HPP |
| 16 | |
| 17 | #if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) |
| 18 | |
| 19 | #include <boost/format/group.hpp> |
| 20 | #include <ostream> |
| 21 | |
| 22 | namespace boost { |
| 23 | namespace io { |
| 24 | namespace detail { |
| 25 | |
| 26 | template< class Ch, class Tr, class T > |
| 27 | struct disambiguater |
| 28 | { |
| 29 | template< typename U > |
| 30 | static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long) |
| 31 | { |
| 32 | os << group_head(x.a1_); |
| 33 | } |
| 34 | static void put_head(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int) |
| 35 | { |
| 36 | } |
| 37 | template< typename U > |
| 38 | static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, group1<U> const& x, long) |
| 39 | { |
| 40 | os << group_last(x.a1_); |
| 41 | } |
| 42 | static void put_last(BOOST_IO_STD basic_ostream<Ch, Tr>& os, T const& x, int) |
| 43 | { |
| 44 | os << x; |
| 45 | } |
| 46 | }; |
| 47 | |
| 48 | } // namespace detail |
| 49 | } // namespace io |
| 50 | } // namespace boost |
| 51 | |
| 52 | #endif // -__DECCXX_VER |
| 53 | |
| 54 | #endif // -BOOST_MSVC_DISAMBIGUATER_HPP |
| 55 | |