Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is an old version of boost. Click here for the latest version's documentation home page.

[Home]clear

Synopsis

template<
      typename Sequence
    >
struct clear
{
    typedef unspecified type;
};

Description

Returns an empty sequence that preserves all the functional and performance characteristics of the original Sequence, except its size and identity.

Definition

#include "boost/mpl/clear.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of Extensible Sequence

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef clear<Sequence>::type s;A model of Extensible SequenceEquivalent to typedef erase<Sequence, begin<Sequence>::type, end<Sequence>::type>::type s;empty<s>::type::value == true

Complexity

Amortized constant time [1].

Example

typedef list_c<int,1,3,5,7,9,11> odds;
typedef clear<odds>::type nothing;
BOOST_STATIC_ASSERT(empty<nothing>::type::value);

Notes

[1] The algorithm is provided only if the sequence can meet the stated complexity requirements.

See also

Extensible Sequence, erase, empty, begin, end


Table of Contents
Last edited July 17, 2002 3:58 am