Function Template adapt

Overview
Headers
Reference

Overview

The overloaded function template adapt takes an OutputIterator, a pair of ForwardIterators or a standard i/o stream or stream buffer and returns a Device.[1] Certain properties of the returned Device, including its i/o mode, are left indeterminate until the Device is added to a filtering_streambuf or filtering_stream. This is for two reasons:

See STL Sequence Adapters for usage examples.

Headers

<boost/iostreams/adapt.hpp>

Reference

Synopsis

namespace boost { namespace iostreams {
              
    template<typename OutIt>
    implementation-defined adapt(const OutIt& out);
    
    template<typename FwdIt>
    implementation-defined adapt(FwdIt first, FwdIt last);
    
    template<typename Ch, typename Tr>
    implementation-defined adapt(std::basic_iostream<Ch, Tr>& io);
    
    template<typename Ch, typename Tr>
    implementation-defined adapt(std::basic_streambuf<Ch, Tr>& sb);

} } // End namespace boost::io

adapt — OutputIterators

    template<typename OutIt>
    implementation-defined adapt(const OutIt& out);

Template Parameters

OutIt- A model of OutputIterator.

Return Value

Returns a Sink for writing to the sequence controlled by out.[1]

adapt — Iterator Ranges

    template<typename FwdIt>
    implementation-defined adapt(FwdIt first, FwdIt last);

Template Parameters

Source- A model of ForwardIterator.

Return Value

Returns a Device for accessing the sequence delimited by first and last.[1] The i/o mode of the Device is determined at the time it is added to a filtering_streambuf or filtering_stream.

adapt — Standard I/O Streams and Stream Buffers

    template<typename Ch, typename Tr>
    implementation-defined adapt(std::basic_iostream<Ch, Tr>& io);
    
    template<typename Ch, typename Tr>
    implementation-defined adapt(std::basic_streambuf<Ch, Tr>& sb);

Template Parameters

Ch- A character type.
Tr- A standard library character traits type ([ISO], 21.1.1) with char_type equal to Ch

Return Value

Returns a Device for accessing the sequence or sequences controlled by the given i/o stream or stream buffer.[1] The i/o mode of the Device is determined at the time it is added to a filtering_streambuf or filtering_stream.


[1]Striclty speaking, the object returned is not a true Device, since its i/o mode and possibly its character type are indeterminate. It is better termed a pseudo Device.