From: Daniel James (daniel_at_[hidden])
Date: 2004-11-17 05:20:48


David Abrahams wrote:
> Daniel James <daniel_at_[hidden]> writes:
>
>
>>Sorry, another feature request. Would it be possible/a good idea to
>>add a way to get the type of a named parameter?
>
>
> Certainly it's possible. Not sure if it's a good idea. Is there a
> use case? Some people are complaining that the library is already
> heavy artillery where none is needed.

Mostly it would just be for convenience. For example, if you want to
copy a parameter to a local variable, or get the iterator type for a
container parameter, you can move the implementation into a separate
template function which will know the type. It looks like the library is
designed so that if you want to do anything non-trivial, you need to do
a further function forward. I guess this is not necessarily a bad thing,
since it keeps it simpler.

The one use that I can think of that can't be done this way is if you
want the return type of the function to be dependant on the parameters.

Daniel