1 // (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2 // (C) Copyright 2003-2007 Jonathan Turkanis
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
6 // See http://www.boost.org/libs/iostreams for documentation.
8 #ifndef BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED
9 #define BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED
11 #include <boost/iostreams/detail/broken_overload_resolution/forward.hpp>
13 namespace boost
{ namespace iostreams
{
17 BOOST_IOSTREAMS_CHAR_TRAITS(
18 BOOST_DEDUCED_TYPENAME char_type_of
<T
>::type
22 BOOST_DEDUCED_TYPENAME char_type_of
<T
>::type
24 typename Mode
= BOOST_DEDUCED_TYPENAME mode_of
<T
>::type
>
26 : public detail::stream_buffer_traits
<T
, Tr
, Alloc
, Mode
>::type
31 BOOST_DEDUCED_TYPENAME
iostreams::category_of
<T
>::type
, Mode
35 detail::stream_buffer_traits
<
39 typedef typename char_type_of
<T
>::type char_type
;
45 BOOST_IOSTREAMS_STREAMBUF_TYPEDEFS(Tr
)
50 if (this->is_open() && this->auto_close())
55 stream_buffer(const U0
& u0
)
57 open_impl(detail::forward
<T
, U0
>(), u0
);
59 template<typename U0
, typename U1
>
60 stream_buffer(const U0
& u0
, const U1
& u1
)
62 open_impl(detail::forward
<T
, U0
>(), u0
, u1
);
64 template<typename U0
, typename U1
, typename U2
>
65 stream_buffer(const U0
& u0
, const U1
& u1
, const U2
& u2
)
67 open_impl(detail::forward
<T
, U0
>(), u0
, u1
, u2
);
69 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
73 open_impl(detail::forward
<T
, U0
>(), u0
);
75 template<typename U0
, typename U1
>
76 stream_buffer(U0
& u0
, const U1
& u1
)
78 open_impl(detail::forward
<T
, U0
>(), u0
, u1
);
80 template<typename U0
, typename U1
, typename U2
>
81 stream_buffer(U0
& u0
, const U1
& u1
, const U2
& u2
)
83 open_impl(detail::forward
<T
, U0
>(), u0
, u1
, u2
);
85 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
87 void open(const U0
& u0
)
89 open_impl(detail::forward
<T
, U0
>(), u0
);
91 template<typename U0
, typename U1
>
92 void open(const U0
& u0
, const U1
& u1
)
94 open_impl(detail::forward
<T
, U0
>(), u0
, u1
);
96 template<typename U0
, typename U1
, typename U2
>
97 void open(const U0
& u0
, const U1
& u1
, const U2
& u2
)
99 open_impl(detail::forward
<T
, U0
>(), u0
, u1
, u2
);
101 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
102 template<typename U0
>
105 open_impl(detail::forward
<T
, U0
>(), u0
);
107 template<typename U0
, typename U1
>
108 void open(U0
& u0
, const U1
& u1
)
110 open_impl(detail::forward
<T
, U0
>(), u0
, u1
);
112 template<typename U0
, typename U1
, typename U2
>
113 void open(U0
& u0
, const U1
& u1
, const U2
& u2
)
115 open_impl(detail::forward
<T
, U0
>(), u0
, u1
, u2
);
117 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
118 T
& operator*() { return *this->component(); }
119 T
* operator->() { return this->component(); }
121 template<typename U0
>
122 void open_impl(mpl::false_
, const U0
& u0
)
124 base_type::open(const_cast<U0
&>(u0
), -1, -1);
126 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
127 template<typename U0
>
128 void open_impl(mpl::false_
, U0
& u0
)
130 base_type::open(detail::wrap(u0
), -1, -1);
132 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
133 template<typename U0
>
134 void open_impl(mpl::true_
, const U0
& u0
)
136 base_type::open(T(const_cast<U0
&>(u0
)), -1, -1);
138 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
139 template<typename U0
>
140 void open_impl(mpl::true_
, U0
& u0
)
142 base_type::open(T(u0
), -1, -1);
144 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
145 template<typename U0
, typename U1
>
146 void open_impl(mpl::false_
, const U0
& u0
, const U1
& u1
)
148 base_type::open(u0
, u1
, -1);
150 template<typename U0
, typename U1
>
151 void open_impl(mpl::true_
, const U0
& u0
, const U1
& u1
)
153 base_type::open(T(const_cast<U0
&>(u0
), u1
), -1, -1);
155 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
156 template<typename U0
, typename U1
>
157 void open_impl(mpl::true_
, U0
& u0
, const U1
& u1
)
159 base_type::open(T(u0
, u1
), -1, -1);
161 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
162 template<typename U0
, typename U1
, typename U2
>
163 void open_impl(mpl::false_
, const U0
& u0
, const U1
& u1
, const U2
& u2
)
165 base_type::open(u0
, u1
, u2
);
167 template<typename U0
, typename U1
, typename U2
>
168 void open_impl(mpl::true_
, const U0
& u0
, const U1
& u1
, const U2
& u2
)
170 base_type::open(T(const_cast<U0
&>(u0
), u1
, u2
), -1, -1);
172 #if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------------//
173 template<typename U0
, typename U1
, typename U2
>
174 void open_impl(mpl::true_
, U0
& u0
, const U1
& u1
, const U2
& u2
)
176 base_type::open(T(u0
, u1
, u2
), -1, -1);
178 #endif // !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) //---------------------------//
182 throw BOOST_IOSTREAMS_FAILURE("already open");
186 } } // End namespaces iostreams, boost.
188 #endif // BOOST_IOSTREAMS_DETAIL_BROKEN_OVERLOAD_RESOLUTION_STREAM_BUFFER_HPP_INCLUDED