I have struct like :
struct E1
{
typedef boost::tuple<
boost::optional< N::type_A >, // N - namespace
boost::optional< N::type_B >,
...................
boost::optional< N::type_X > //arbitrary number of, maximal is 7
> data_type;
// for access by name
boost::optional<N::type_A> const& type_A() const { return boost::get<0>(data); }
boost::optional<N::type_B> const& type_B() const { return boost::get<1>(data); }
.....................................
boost::optional<N::type_X> const& type_X() const { return boost::get<2>(data); }
data_type data;
};
Q: how I may create this structure using BOOST preprocessors? For me known only type_A, type_B, ..., type_X name of types.
It's need me, because I must create a lot of structures like that, only changing type_A, type_B, ... types.
In common case, can I use boost preprocessor array or set?
#undef
the macros once we are done with them; there is no need to pollute the global namespace for our clients :) – Houlberg