August 2017
Intermediate to advanced
438 pages
14h 19m
English
We already saw how a type can be manipulated at compile time. Why can't we go further and combine multiple types in an array and perform operations for each element of that array?
#include <boost/mpl/vector.hpp>template <
class T0, class T1, class T2, class T3, class T4,
class T5, class T6, class T7, class T8, class T9
>
struct variant {
typedef boost::mpl::vector<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9
> types;
};
#include <string>
struct declared{ unsigned char data[4096]; };
struct non_declared;typedef variant< volatile int, const int, const long, declared, non_declared, ...Read now
Unlock full access