boost::mpl::single_view

# single_view

### Synopsis

    template<
          typename T
        >
    struct single_view
    {
        // unspecified
    };

### Description

Allows one to represent an arbitrary type `T` as a single-element sequence.

### Definition

    #include "boost/mpl/single_view.hpp"

### Parameters

Parameter | Requirement | Description
--- | --- | ---
`T` | A type | The type to be wrapped in a sequence.

### Expression semantics

Expression | Expression type | Precondition | Semantics | Postcondition
--- | --- | --- | --- | ---
`typedef single_view<T> s;` | A model of Sequence |  | `s` is a random-access, single-element sequence such as `front<s>::type` is identical to `T` | `size<s>::type::value == 1, boost::same_as<front<s>::type,T>::value == true`.

### Complexity

Amortized constant time.

### Example

    typedef single_view<int> view;
    typedef begin<view>::type first;
    typedef end<view>::type last;

    BOOST_MPL_ASSERT_IS_SAME(first::type,int);
    BOOST_MPL_ASSERT_IS_SAME(first::next,last);
    BOOST_MPL_ASSERT_IS_SAME(last::prior,first);

    BOOST_STATIC_ASSERT(size<view>::type::value == 1);

### See also

Sequences, `transform_view`, `filter_view`, `joint_view`, `zip_view`

Table of Contents
Last edited March 10, 2003 5:19 am