Boost logo

Boost :

From: David A. Greene (greened_at_[hidden])
Date: 2002-08-07 15:30:46

Paul Mensonides wrote:

> 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 {
> // ...
> };
> };

Erk...this strikes me as a bit ugly. Doesn't the interface for
some_class have to be re-declared in each specialization?
I don't see how this provides any decoupling. I'm missing
something important here.

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

I don't follow you here.

>>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.

Sure. I guess I don't understand how variable-length template
parameter lists would be used, then. I'm missing a piece of
the puzzle.


"Some little people have music in them, but Fats, he was all music,
  and you know how big he was."  --  James P. Johnson

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