...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
template<
typename T
>
struct single_view
{
// unspecified
};
Allows one to represent an arbitrary type T
as a single-element sequence.
#include "boost/mpl/single_view.hpp"
Parameter | Requirement | Description |
---|---|---|
T | A type | The type to be wrapped in a sequence. |
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 . |
Amortized constant time.
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);
Sequences, transform_view
, filter_view
, joint_view
, zip_view