Boost logo

Boost :

From: Fredrik Blomqvist (fredrik_blomqvist_at_[hidden])
Date: 2004-02-08 15:04:11


David Abrahams wrote:
> Hi,
>
> I know we've discussed this in the past, but did we ever settle on an
> interface for deducing the return and parameter types of function
> (object)s? Doug G.'s result_of<F(a,b)> template works for return
> types, but it's not very portable and is not even in Boost proper
> AFAIK. Many function objects and all function pointers have specific
> (non-templated) parameter types, and it would be extremely valuable
> to be able to deduce those as well.
>
> It's hard to believe that with all the functional programming
> libraries we have, there's no standardized facility for this sort of
> deduction.

I'm joining this thread slightly late but nonetheless, this is on my
wish-list too and
I've got code right now that would greatly benefit from standardized return
type deduction.

What I want to add to the discussion is that I believe we need _two_
versions of return_type (or whatever we choose to call it).
Even though I like the power and syntax of the result_of<F(a,b)>, I'd say
it's not unreasonable to be in a situation where the argument types (if any)
simply aren't know. In such cases a plain return_type<F> that would atleast
make an "educated guess" would be better than nothing.

Just my 2c
// Fredrik Blomqvist


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