Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2002-08-06 18:14:19


----- Original Message -----
From: "David A. Greene" <greened_at_[hidden]>

> I've been kicking this around a bit. Wouldn't it allow some
> decoupling of template parameter processing (the "class
> metaimplementation") from the class interface, similar to the
> pimpl idiom? Now, in all practicality it might not work
> because of compiler limitations, but I see an analogy between
> pimpl and typelists. Just as pimpl provides a single entry
> point to an arbitrarily complex data structure, a typelist
> provides a single (template parameter) entry point to an
> arbitrarily complex data structure of types.

There are several ways to maintain an interface while changing arities.

template<int> struct some_class;

template<> struct some_class<1> {
    template<class T> struct args {
        // ...
    };
};

template<> struct some_class<2> {
    template<class T, class U> struct args {
        // ...
    };
};

You can also extract parameter types from a function type, etc..

> This sort of thing can allow template interface wrappers
> around template impl classes.
>
> Maybe it's not all that useful but it's fun to think about. :)
>
> In any event, I've seen calls in various places (c.l.c++.m
> and here, I think) for variable-length template parameter
> lists. What are those good for? Typelists seem to provide
> the same functionality. Well, in the same way std::vector
> provides variable-length function argument lists. :)

Typelists only supply the same functionality for types. They don't extend to
other variable-length arities such as parameter lists.

Paul Mensonides


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