Function Template restrict

# Function Template `restrict`

Description
Headers
Reference

## Description

Given a Filter or Device that provides access to a single character sequence, we can construct a second Filter or Device which provides access to contiguous subsequence of the the original sequence. This second Filter or Device is called a restriction of the original device. Restrictions are represented by instances of the class template `restriction`. The function template `resrict` is an object generator which returns an appropriate instance of `resriction` when passed a Filter or Device and a pair of values indicating the endpoints of the restricted subsequence.

The mode of a `resriction` is the same as that of the underlying component. A `resriction` is Closable, Flushable, Localizable and OptimallyBuffered.

The function template `slice` is available as an alias of `restrict`, for platforms that treat `restrict` as a keyword.

## Headers

`<boost/iostreams/restrict.hpp>`

## Reference

#### Synopsis

    namespace boost { namespace iostreams {

    template<typename Component>
    class restriction {
    public:
        typedef typename char_type_of<Component>::type  char_type;
        typedef implementation-defined                  mode;

        restriction( [const] Component& component,
                     stream_offset off,
                     stream_offset len = -1 );

        // Filter or Device member functions
    };

    template<typename Component>
    restriction<Component>
    restrict( [const] Component& component,
              stream_offset off,
              stream_offset len = -1 );

    } } // End namespace boost::io

## Class Template `restriction`

#### Template parameters

Component | - | A model of Filter or Device

#### `restriction::restriction`

        restriction( [const] Component& component,
                     stream_offset off,
                     stream_offset len = -1 );

Constructs an instance of `restriction` based on the given component and offsets. The parameters have the following interpretation:

component | - | The Filter or Device to be restricted. If `Component` is a stream or stream buffer type, the function parameter is a non-`const` reference; otherwise it is a `const` reference.
off | - | The offset of the beginning of the restricted character sequence.
len | - | The length of the restricted character sequence. A value of `-1` indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.

## Function Template `restrict`

    template<typename Component>
    restriction<Component>
    restrict( [const] Component& component,
              stream_offset off,
              stream_offset len = -1 );

#### Template parameters

Component | - | A model of Filter or Device

Constructs an instance of an appropriate specialization of `restriction` based on the given component and offsets. The parameters have the following interpretation:

component | - | The Filter or Device to be restricted. If `Component` is a stream or stream buffer type, the function parameter is a non-`const` reference; otherwise it is a `const` reference.
off | - | The offset of the beginning of the restricted character sequence.
len | - | The length of the restricted character sequence. A value of `-1` indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.

© Copyright 2008 CodeRage, LLC
© Copyright 2004-2007 Jonathan Turkanis

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)