diff --git a/include/boost/iostreams/seek.hpp b/include/boost/iostreams/seek.hpp index 91865ad..b09f1e2 100755 --- a/include/boost/iostreams/seek.hpp +++ b/include/boost/iostreams/seek.hpp @@ -30,7 +30,10 @@ namespace boost { namespace iostreams { namespace detail { template -struct seek_impl; +struct seek_device_impl; + +template +struct seek_filter_impl; } // End namespace detail. @@ -38,18 +41,30 @@ template inline std::streampos seek( T& t, stream_offset off, BOOST_IOS::seekdir way, BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) -{ return detail::seek_impl::seek(detail::unwrap(t), off, way, which); } +{ + using namespace detail; + return seek_device_impl::seek(detail::unwrap(t), off, way, which); +} + +template +inline std::streampos +seek( T& t, Device& dev, stream_offset off, BOOST_IOS::seekdir way, + BOOST_IOS::openmode which = BOOST_IOS::in | BOOST_IOS::out ) +{ + using namespace detail; + return seek_filter_impl::seek(detail::unwrap(t), dev, off, way, which); +} namespace detail { -//------------------Definition of seek_impl-----------------------------------// +//------------------Definition of seek_device_impl----------------------------// template -struct seek_impl +struct seek_device_impl : mpl::if_< is_custom, operations, - seek_impl< + seek_device_impl< BOOST_DEDUCED_TYPENAME dispatch< T, iostream_tag, istream_tag, ostream_tag, @@ -77,16 +92,16 @@ struct seek_impl_basic_ios { }; template<> -struct seek_impl : seek_impl_basic_ios { }; +struct seek_device_impl : seek_impl_basic_ios { }; template<> -struct seek_impl : seek_impl_basic_ios { }; +struct seek_device_impl : seek_impl_basic_ios { }; template<> -struct seek_impl : seek_impl_basic_ios { }; +struct seek_device_impl : seek_impl_basic_ios { }; template<> -struct seek_impl { +struct seek_device_impl { template static std::streampos seek( T& t, stream_offset off, BOOST_IOS::seekdir way, @@ -104,7 +119,7 @@ struct seek_impl { }; template<> -struct seek_impl { +struct seek_device_impl { template static std::streampos seek( T& t, stream_offset off, BOOST_IOS::seekdir way, @@ -113,7 +128,7 @@ struct seek_impl { }; template<> -struct seek_impl { +struct seek_device_impl { template static std::streampos seek( T& t, stream_offset off, BOOST_IOS::seekdir way, @@ -121,6 +136,40 @@ struct seek_impl { { return t.seek(off, way); } }; +//------------------Definition of seek_filter_impl----------------------------// + +template +struct seek_filter_impl + : mpl::if_< + is_custom, + operations, + seek_filter_impl< + BOOST_DEDUCED_TYPENAME + dispatch::type + > + >::type + { }; + +template<> +struct seek_filter_impl { + template + static std::streampos seek( T& t, Device& d, + stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode which ) + { return t.seek(d, off, way, which); } +}; + +template<> +struct seek_filter_impl { + template + static std::streampos seek( T& t, Device& d, + stream_offset off, + BOOST_IOS::seekdir way, + BOOST_IOS::openmode ) + { return t.seek(d, off, way); } +}; + } // End namespace detail. } } // End namespaces iostreams, boost.