Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2007-08-26 15:12:40


David Abrahams wrote:
> What is the advantage to that over
>
> make_list
> < base_hook<my_base_hook>
> , constant_time_size<false>
> >::type l;

Just that programmers might found it more familiar, like an STL
container, but I must say that your approach gives me much more
guarantee of a single type, something that is difficult to achieve with:

set<T, set_options<...>::type >;

because I can't define the same options structure as:

set<T, set_options<pred<std::less<T> >, ...>::type >;

... because I have no access to the T type of the set from set_options
(I could pass it again, but that would be verbose. Whereas if I define:

make_set<T, pred<std::less<T>>, ...>::type l;

I have all the needed data to produce a single type. Although it's a bit
different from standard container definitions, your suggestion might be
the right thing to do to achieve both single type and less typing. So I
guess that I can offer both Tobias' approach:

set<T, pred<std::greater<T>, >

and your approach for people that want to make sure that the same types
are being created when specifying the same options.

Thanks,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk