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 to view this page for the latest version.
PrevUpHomeNext
empty
Description

Returns the result type of empty.

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

Table 1.21. Parameters

Parameter

Requirement

Description

Seq

A model of Forward Sequence

Argument sequence


Expression Semantics
result_of::empty<Seq>::type

Return type: An MPL Integral Constant

Semantics: Returns mpl::true_ if Seq has zero elements, mpl::false_ otherwise.

/sequence/intrinsic/empty.hpp>

Example
typedef vector<> empty_vec;
typedef vector<int,float,char> vec;

BOOST_MPL_ASSERT((result_of::empty<empty_vec>));
BOOST_MPL_ASSERT_NOT((result_of::empty<vec>));

PrevUpHomeNext