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
size
Description

Returns a type convertible to int that evaluates the number of elements in the sequence.

Synopsis
template <typename Sequence>
typename result_of::size<Sequence>::type
size(Sequence const& seq);
Parameters

Parameter

Requirement

Description

seq

Model of Forward Sequence

The sequence we wish to investigate.

Expression Semantics
size(seq);

Return type: Convertible to int.

Semantics: Returns the number of elements in the sequence.

Header
#include <boost/fusion/sequence/intrinsic/size.hpp>
#include <boost/fusion/include/size.hpp>
Example
vector<int, int, int> v(1, 2, 3);
assert(size(v) == 3);

PrevUpHomeNext