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 the documentation for an old version of boost. Click here for the latest Boost documentation.

[Home]empty

Synopsis

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

Description

Returns an Integral Constant c such that c::value == true if and only if the sequence is empty.

Definition

#include "boost/mpl/empty.hpp"

Parameters

 Parameter  Requirement  Description  
SequenceA model of Sequence

Expression semantics

 Expression  Expression type  Precondition  Semantics  Postcondition 
typedef empty<Sequence>::type c;A model of bool Integral ConstantEquivalent to typedef is_same< begin<Sequence>::type,end<Sequence>::type >::type c;

Complexity

Amortized constant time.

Example

typedef range_c<int,0,0> empty_range;
typedef list<long,float,double> types;

BOOST_STATIC_ASSERT(empty<empty_range>::value) BOOST_STATIC_ASSERT(!empty<types>::value)

See also

Sequence, size, begin, end


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