![]() |
Home | Libraries | People | FAQ | More |
vector
is a Random
Access Sequence of heterogenous typed data structured as a simple
struct
where each element
is held as a member variable. vector
is the simplest of the Fusion sequence container, and in many cases the
most efficient.
#include <boost/fusion/sequence/container/vector.hpp> #include <boost/fusion/sequence/container/vector/vector_fwd.hpp> // numbered forms #include <boost/fusion/sequence/container/vector/vector10.hpp> #include <boost/fusion/sequence/container/vector/vector20.hpp> #include <boost/fusion/sequence/container/vector/vector30.hpp> #include <boost/fusion/sequence/container/vector/vector40.hpp> #include <boost/fusion/sequence/container/vector/vector50.hpp>
Numbered forms
template <> struct vector0; template <typename T0> struct vector1; template <typename T0, typename T1> struct vector2; template <typename T0, typename T1, typename T2> struct vector3; ... template <typename T0, typename T1, typename T2..., typename TN> struct vectorN;
Variadic form
template < typename T0 = unspecified , typename T1 = unspecified , typename T2 = unspecified ... , typename TN = unspecified > struct vector;
The numbered form accepts the exact number of elements. Example:
vector3<int, char, double>
The variadic form accepts 0
to FUSION_MAX_VECTOR_SIZE
elements, where FUSION_MAX_VECTOR_SIZE
is a user definable predefined maximum that defaults to 10
.
Example:
vector<int, char, double>
You may define the preprocessor constant FUSION_MAX_VECTOR_SIZE
before including any Fusion header to change the default. Example:
#define FUSION_MAX_VECTOR_SIZE 20
Parameter |
Description |
Default |
---|---|---|
|
Element types |
unspecified |
Notation
v
vector
V
vector
type
e0
...en
s
Semantics of an expression is defined only where it differs from, or is not defined in Random Access Sequence.
Expression |
Semantics |
---|---|
|
Creates a vector with default constructed elements. |
|
Creates a vector with elements |
|
Copy constructs a vector from a Forward
Sequence, |
|
Assigns to a vector, |
vector<int, float> v(12, 5.5f); std::cout <<at_c
<0>(v) << std::endl; std::cout <<at_c
<1>(v) << std::endl;
Copyright © 2001-2007 Joel de Guzman, Dan Marsden, Tobias Schwinger |