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

Front Page / Sequences / Concepts / Variadic Sequence

Variadic Sequence

Description

A Variadic Sequence is a member of a family of sequence classes with both variadic and numbered forms. If seq is a generic name for some Variadic Sequence, its variadic form allows us to specify a sequence of n elements t1,t2,... tn, for any n from 0 up to a preprocessor-configurable limit BOOST_MPL_LIMIT_seq_SIZE, using the following notation:

seq<t1,t2,... tn>

By contrast, each numbered sequence form accepts the exact number of elements that is encoded in the name of the corresponding class template:

seqn<t1,t2,... tn>

For numbered forms, there is no predefined top limit for n, aside from compiler limitations on the number of template parameters.

Expression requirements

In the following table and subsequent specifications, seq is a placeholder token for the actual Variadic Sequence name.

Expression Type Complexity
seq<t1,t2,... tn> Forward Sequence Amortized constant time
seq<t1,t2,... tn>::type Forward Sequence Amortized constant time
seqn<t1,t2,... tn> Forward Sequence Amortized constant time
seqn<t1,t2,... tn>::type Forward Sequence Amortized constant time

Expression semantics

typedef seq<t1,t2,... tn> s;
typedef seqn<t1,t2,... tn> s;
Semantics:s is a sequence of elements t1,t2,... tn.
Postcondition:size<s>::value == n.
typedef seq<t1,t2,... tn>::type s;
typedef seqn<t1,t2,... tn>::type s;
Semantics:s is identical to seqn<t1,t2,... tn >.
Postcondition:size<s>::value == n.

Models

See also

Sequences, Configuration, Integral Sequence Wrapper