...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 Sequence > struct clear { typedef unspecified type; };
Returns an empty sequence that preserves all the functional and performance characteristics of the original Sequence
, except its size and identity.
#include "boost/mpl/clear.hpp"
Parameter | Requirement | Description |
---|---|---|
Sequence | A model of Extensible Sequence |
Expression | Expression type | Precondition | Semantics | Postcondition |
---|---|---|---|---|
typedef clear<Sequence>::type s; | A model of Extensible Sequence | Equivalent to typedef erase<Sequence, begin<Sequence>::type, end<Sequence>::type>::type s; | empty<s>::type::value == true |
Amortized constant time [1].
typedef list_c<int,1,3,5,7,9,11> odds; typedef clear<odds>::type nothing; BOOST_STATIC_ASSERT(empty<nothing>::type::value);
[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.
Extensible Sequence, erase
, empty
, begin
, end