Home | Libraries | People | FAQ | More |
BOOST_FUSION_DEFINE_TPL_STRUCT is a macro that can be used to generate all the necessary boilerplate to define and adapt an arbitrary template struct as a model of Random Access Sequence.
BOOST_FUSION_DEFINE_TPL_STRUCT( (template_param0)(template_param1)..., (namespace0)(namespace1)..., struct_name, (member_type0, member_name0) (member_type1, member_name1) ... )
Notation
Str
An instantiated struct_name
str
An instance of Str
e0
...en
Heterogeneous values
fs
The above macro generates the necessary code that defines and adapts struct_name
as a model of Random
Access Sequence. The sequence (template_param0)(template_param1)...
declares the names of the template type parameters used. The sequence (namespace0)(namespace1)...
declares the namespace for struct_name
. It yields to a fully qualified
name for struct_name
of
namespace0::namespace1::...
struct_name
. If an empty namespace
sequence is given (that is a macro that expands to nothing), the struct is
placed in the global namespace. The sequence of (member_typeN,
member_nameN)
pairs declares the type and names of each of the struct members that are
part of the sequence.
The macro should be used at global scope. Semantics of an expression is defined only where it differs from, or is not defined in Random Access Sequence.
Expression |
Semantics |
---|---|
|
Creates an instance of |
|
Creates an instance of |
|
Copy constructs an instance of |
|
Assigns from a Forward
Sequence |
|
Access of struct member |
#include <boost/fusion/adapted/struct/define_struct.hpp> #include <boost/fusion/include/define_struct.hpp>
// Any instantiated demo::employee is a Fusion sequence BOOST_FUSION_DEFINE_TPL_STRUCT( (Name)(Age), (demo), employee, (Name, name) (Age, age))