Boost logo

Boost Users :

Subject: Re: [Boost-users] mpl::transform<...> --- compile error: is not derived from type
From: e r (erwann.rogard_at_[hidden])
Date: 2008-09-07 17:37:23


e r wrote:
> e r wrote:
>> hi,
>>
>> here's the problem i have:
>> struct my{
>> template<typename UInt>
>> struct apply{
>> typedef mpl::int_<UInt::value> type;
>> };
>> };
>>
>> template<int First,int Last>
>> struct id_range{
>> typedef mpl::transform<
>> mpl::range_c<int,First,Last>
>> , my
>> , mpl::back_inserter< mpl::vector<> >
>> >::type type;
>>
>> /home/er/cpp/boost/random/mcmc/id_range.hpp|32|error: type
>> ‘boost::mpl::transform<boost::mpl::range_c<int, First, Last>,
>> boost::random::mcmc::<unnamed>::my,
>> boost::mpl::back_inserter<boost::mpl::vector<mpl_::na, mpl_::na,
>> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
>> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
>> mpl_::na, mpl_::na, mpl_::na, mpl_::na> >, mpl_::na>’ is not derived
>> from type ‘boost::random::mcmc::id_range<First, Last>’|
>>
>> however, for example, this --instead-- compiles fine:
>>
>> struct id_range{
>> typedef mpl::transform<
>> mpl::range_c<int,1,3>
>> , my
>> , mpl::back_inserter< mpl::vector<> >
>> >::type type;
>> };
>> any suggestion appreciated. thanks!
>
>
> and also, although the second version compiles, i have
>
> BOOST_MPL_ASSERT( (
> is_same<
> id_range::type,
> mpl::vector< mpl::int_<1>, mpl::int_<2>, mpl::int_<3> >
> >
> ) );
>
> causes,
>
> error: no matching function for call to
> ‘assertion_failed(mpl_::failed************
> boost::is_same<boost::mpl::v_item<mpl_::int_<2>,
> boost::mpl::v_item<mpl_::int_<1>, boost::mpl::vector<mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na>, 0>, 0>,
> boost::mpl::vector<mpl_::int_<1>, mpl_::int_<2>, mpl_::int_<3>,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na,
> mpl_::na, mpl_::na, mpl_::na> >::************)’|

In the first post: there's a typename missing, which solves the problem.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net