#include <boost/tuple/tuple.hpp>
#include <boost/mpl/vector_c.hpp>
#include <boost/mpl/transform.hpp>
#include <boost/fusion/adapted/struct/adapt_struct.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/mpl.hpp> // makes params a MPL sequence
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/fusion/include/is_sequence.hpp>
struct params {
double d1;
double d2;
double d3;
unsigned int i4;
unsigned int i5;
unsigned int i6;
unsigned int i7;
};
BOOST_FUSION_ADAPT_STRUCT(
params,
(double, d1)
(double, d2)
(double, d3)
(unsigned int, i4)
(unsigned int, i5)
(unsigned int, i6)
(unsigned int, i7)
)
BOOST_MPL_ASSERT(( boost::fusion::traits::is_sequence<params> )); // passes
template <typename T1>
struct rangify {
typedef boost::tuple<T1, T1, T1> type; /// min max incr
};
template <typename T>
struct fixed_or_range {
typedef struct {
union {
T fixed;
typename rangify<T>::type range;
};
bool is_fixed;
}
type;
};
typedef boost::mpl::transform< params, fixed_or_range<boost::mpl::_> >::type params_fixed_or_range;