.. Sequences/Views//single_view single_view =========== Synopsis -------- .. parsed-literal:: template< typename T > struct single_view { // |unspecified| // |...| }; Description ----------- A view onto an arbitrary type ``T`` as on a single-element sequence. Header ------ .. parsed-literal:: #include Model of -------- * |Random Access Sequence| Parameters ---------- +---------------+-------------------+-----------------------------------------------+ | Parameter | Requirement | Description | +===============+===================+===============================================+ | ``T`` | Any type | The type to be wrapped in a sequence. | +---------------+-------------------+-----------------------------------------------+ Expression semantics -------------------- |Semantics disclaimer...| |Random Access Sequence|. In the following table, ``v`` is an instance of ``single_view``, ``x`` is an arbitrary type. +-------------------------------+-----------------------------------------------------------+ | Expression | Semantics | +===============================+===========================================================+ | .. parsed-literal:: | A single-element |Random Access Sequence| ``v`` such that | | | ``front::type`` is identical to ``x``. | | single_view | | | single_view::type | | +-------------------------------+-----------------------------------------------------------+ | ``size::type`` | The size of ``v``; ``size::value == 1``; | | | see |Random Access Sequence|. | +-------------------------------+-----------------------------------------------------------+ Example ------- .. parsed-literal:: typedef single_view view; typedef begin::type first; typedef end::type last; BOOST_MPL_ASSERT(( is_same< deref::type,int > )); BOOST_MPL_ASSERT(( is_same< next::type,last > )); BOOST_MPL_ASSERT(( is_same< prior::type,first > )); BOOST_MPL_ASSERT_RELATION( size::value, ==, 1 ); See also -------- |Sequences|, |Views|, |iterator_range|, |filter_view|, |transform_view|, |joint_view|, |zip_view| .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams 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)