1 .. Sequences/Views//single_view
25 A view onto an arbitrary type ``T`` as on a single-element sequence.
33 #include <boost/mpl/single_view.hpp>
39 * |Random Access Sequence|
45 +---------------+-------------------+-----------------------------------------------+
46 | Parameter | Requirement | Description |
47 +===============+===================+===============================================+
48 | ``T`` | Any type | The type to be wrapped in a sequence. |
49 +---------------+-------------------+-----------------------------------------------+
55 |Semantics disclaimer...| |Random Access Sequence|.
57 In the following table, ``v`` is an instance of ``single_view``, ``x`` is an arbitrary type.
59 +-------------------------------+-----------------------------------------------------------+
60 | Expression | Semantics |
61 +===============================+===========================================================+
62 | .. parsed-literal:: | A single-element |Random Access Sequence| ``v`` such that |
63 | | ``front<v>::type`` is identical to ``x``. |
65 | single_view<x>::type | |
66 +-------------------------------+-----------------------------------------------------------+
67 | ``size<v>::type`` | The size of ``v``; ``size<v>::value == 1``; |
68 | | see |Random Access Sequence|. |
69 +-------------------------------+-----------------------------------------------------------+
76 typedef single_view<int> view;
77 typedef begin<view>::type first;
78 typedef end<view>::type last;
80 BOOST_MPL_ASSERT(( is_same< deref<first>::type,int > ));
81 BOOST_MPL_ASSERT(( is_same< next<first>::type,last > ));
82 BOOST_MPL_ASSERT(( is_same< prior<last>::type,first > ));
84 BOOST_MPL_ASSERT_RELATION( size<view>::value, ==, 1 );
90 |Sequences|, |Views|, |iterator_range|, |filter_view|, |transform_view|, |joint_view|, |zip_view|
93 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
94 Distributed under the Boost Software License, Version 1.0. (See accompanying
95 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)