Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2002-03-01 16:53:06

Jeremy Siek wrote:
> The change you suggest is in fact the current approach we use to work
> around VC++. As to whether that approach is simpler is not so clear to me.
> For example, the 2nd approach requires a nested class, which could be
> regarded as a complication. Overall, I'd classify this NAD ;)

> david.> struct list_with_allocatorS { template <class ValueType> struct apply {
> david.> typedef typename Alloc::template rebind<ValueType>::other Allocator;
> david.> typedef std::list<ValueType, Allocator> type;
> david.> }; };

Yes, I'm late at it, but I'd like to say I agree with David here.
Also in terms of the recent template metaprogramming discussion,
it appears to me that the nested class template is the way to
go for any situation where you'd have wanted template template
parameters but they were too limiting.

What David is proposing is to have a user-defined metafunction to
create the list type the user wants. Terminology-wise, this blends
nicely with whatever template metaprogramming aids we come up
with later. In my opinion, thinking about it this way
("here's a function that produces some list type") is actually
easier and much more straightforward than thinking in terms of
partial specializations.

Also, there's no "global state" as with a (partial)
specialization in the boost namespace, and all the helper
types I need are indeed localized in the user's namespace.

Jens Maurer

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