Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2002-10-08 17:04:00

Yitzhak Sapir wrote:
> But learning mpl was a nice challenge so instead, I created
> something that
> works as follows:
> std::list<int> l3(
> ct_init_iterator<boost::mpl::list_c<int, 2, 3, 5, 7>,
> int>::type(),
> ct_init_iterator<boost::mpl::list_c<int>, int>::type()
> );
> std::list<int> l4(
> ct_init_iterator<boost::mpl::vector_c<int, 2, 3, 5, 7,
> 11, 13> >::type(),
> ct_init_iterator<boost::mpl::vector_c<int> >::type()
> );
> It's quite annoying that I don't have the equivalent of
> Cont::value_type for list_c/vector_c/range_c. I needed it in
> the case of the empty list too so I'd know what kind of end-marker
> iterator to generate.

An oversight indeed. I'll add 'value_type' typedef to these three.

> Also why does list_c allow specifying a type but defaults all
> parameters to long?
> Couldn't list_c<class T, T c1, T c2, etc.> have been used? (Like in
> integral_c?)

Nope, because due to its variadic interface 'list_c<T,...>' needs to reserve
some single value for denoting unused arguments, and taking that value out
of range of possible values of type 'T' is not really a feasible option
(consider, for instance, T == bool).


> Also, there's a little bug in the at.hpp documentation. The
> documentation suggests that the format is at<N, Sequence>
> whereas the format seems to be at<Sequence, N>.

Oh, yeah, I changed the order of parameters to comply with the review
comments, but haven't updated the docs yet. Thanks for reporting it!

> And for the pair optimization, I need a "is_pair". That
> would have been nice to have in type traits.

    template< typename T >
    struct is_pair
        : mpl::logical_and<
            , has_second<T>


Thanks for the feedback!

Boost list run by bdawes at, gregod at, cpdaniel at, john at