e r | 7 Sep 05:35

mpl::transform<...> --- compile error: is not derived from type

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{
(Continue reading)

e r | 7 Sep 05:44

Re: mpl::transform<...> --- compile error: is not derived from type

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:
> 
(Continue reading)

e r | 7 Sep 23:37

Re: mpl::transform<...> --- compile error: is not derived from type

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:
(Continue reading)

Steven Watanabe | 8 Sep 16:09

Re: mpl::transform<...> --- compile error: is not derived from type

AMDG

e r wrote:
>> 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,
>>
>> <snip>
>>     

Two boost::mpl::vectors that contain the same elements are not guaranteed to
be the same type.  If you boost::mpl::equal, it ought to work.

    BOOST_MPL_ASSERT( (
            boost::mpl::equal<
                id_range::type,
                mpl::vector< mpl::int_<1>, mpl::int_<2>, mpl::int_<3> >
            >
    ) );

In Christ,
Steven Watanabe
(Continue reading)

e r | 9 Sep 05:37

Re: mpl::transform<...> --- compile error: is not derived from type

Steven Watanabe wrote:
> AMDG
> 
> e r wrote:
>>> 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,
>>>
>>> <snip>
>>>     
> 
> Two boost::mpl::vectors that contain the same elements are not
> guaranteed to
> be the same type.  If you boost::mpl::equal, it ought to work.
> 
>    BOOST_MPL_ASSERT( (
>            boost::mpl::equal<
>                id_range::type,
>                mpl::vector< mpl::int_<1>, mpl::int_<2>, mpl::int_<3> >
>            >
>    ) );
> 
> In Christ,
(Continue reading)


Gmane