Boost logo

Boost Users :

From: John C. Femiani (john.femiani_at_[hidden])
Date: 2008-07-27 23:36:28


Stjepan Rajko wrote:
> 2008/7/27 noman javed <noman_bwp_at_[hidden]>:
>
>> struct Poplist
>> {
>> template<class seq>
>> struct apply
>> {
>> typedef pop_front<seq>::type res;
>> static const int value = size<seq>::value;
>> };
>> };
>>
>
> for starts, you need to use typename here:
>
> typedef typename pop_front<seq>::type res;
>
Also, apply does not have a 'type' member typedef, so I think it is not
a metafunction.

What about (untested)

     namespace mpl = ::boost::mpl;
    struct Poplist : mpl::lambda<mpl::pop_front<mpl::placeholders::_1>
>::type {}

or (untested)

    struct poplist{
        template<class Seq> struct apply : mpl::pop_front<Seq> {};
    };

I think section 3.2 of Abraham's 'C++ Template Metaprogramming' book has
some examples.

--John
 


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