I am making small progress in my attempt to generate a new mpl sequence that
I will use to read from a stream.
The following code fails to compile:
#include
#include
#include
#include
#include
#include // makes params a MPL
sequence
#include
#include
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 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_rangeboost::mpl::_ >::type
params_fixed_or_range;
I understand that after the macro BOOST_FUSION_ADAPT_STRUCT , params is a
fusion sequence.
Including made params a MPL sequence, and therefore I
can call boost::mpl::transform<> on it.
The compilation error is
c:\program files (x86)\boost_1_41_0\boost\mpl\clear.hpp(30) : error C2903:
'apply' : symbol is neither a class template nor a function template
1> c:\program files (x86)\boost_1_41_0\boost\mpl\transform.hpp(113) :
see reference to class template instantiation 'boost::mpl::clear<Sequence>'
being compiled
1> with
1> [
1> Sequence=params
1> ]
1> c:\program files (x86)\boost_1_41_0\boost\mpl\eval_if.hpp(41) :
see reference to class template instantiation
'boost::mpl::transform1' being compiled
1> with
1> [
1> P1=params,
1> P2=fixed_or_rangeboost::mpl::_1,
1> P3=boost::mpl::na
1> ]
1> c:\program files (x86)\boost_1_41_0\boost\mpl\transform.hpp(138) :
see reference to class template instantiation 'boost::mpl::eval_if'
being compiled
1> with
1> [
1>
C=boost::mpl::or_boost::mpl::na,boost::mpl::is_lambda_ex
pressionboost::mpl::_1>,boost::mpl::not_boost::mpl::_1>>>,
1>
F1=boost::mpl::transform1boost::mpl::_1,boost::mpl::
na>,
1>
F2=boost::mpl::transform2boost::mpl::_1,boost::mpl::
na,boost::mpl::na>
1> ]
1> c:\users\hich\documents\visual studio
2008\projects\test\test1\main.cpp(51) : see reference to class template
instantiation 'boost::mpl::transform' being compiled
1> with
1> [
1> Seq1=params,
1> Seq2OrOperation=fixed_or_rangeboost::mpl::_1
1> ]
Regards,