Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-04-17 07:49:32

On Wednesday 17 April 2002 01:48 am, you wrote:
> > Issue: passing argument types to the function object wrapper
> [...]
> > On the flip side, I personally still prefer the individual template
> > parameters. They feel like a more obvious translation from function types
> > to function object wrapper types. Functor<void, TYPELIST_3(int, float,
> > double)> bothers me for some reason, and aesthetically I prefer
> > Functor<void, int, float, double> (this could be the bias of seeing the
> > latter very often).
> This can easily be altered. I don't think anybody--even Andrei--would want
> those macros. :) There is an easy solution to this problem:
[snip code]

Sorry, I wasn't clear enough. It's not the macro I dislike, but the explicit
packaging of the arguments in a type container. So I still wouldn't like:

  boost::function<void, boost::mpl::list<int, float, double> >

> > The situation would be much different for me if there were a direct
> > translation from a typelist facility to a function declaration/definition
> > in the language. For instance, if we were able to create a function like:
> >
> > void foo(TYPELIST_4(int, float, double, std::string)) { /* ... */ }
> >
> > and access the members of the typelist in some simple fashion at
> > run-time, then the idea of packaging all of the arguments in a typelist
> > would be more natural in C++. I think I would then support a changeover
> > to that method. - Proposed resolution: No change at this time.
> What do you mean? Loki has a tuple facility that is easy to use. If you
> actually mean using typelists to create a function-declaration like this:
> void foo(int a, float b, double c, std::string d);
> ...That is possible, but I don't know of a way to 'define' a function that
> way--since you can't define a function with a typedef.
> comments. :)
> Paul Mensonides

A function declaration without a definition isn't all that useful :(
I'm basically asking for a typesafe varargs implementation based on
typelists. If that were a part of the language, then I would probably change
my mind about packing arguments into a list-like structure.


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