Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-01-31 11:43:47


From: "Douglas Gregor" <gregod_at_[hidden]>
> So bind won't swallow return values?

No, bind<void> currently doesn't swallow return values.

> I think that an expression like:
>
> bind<T>(single_arg_func, 13)
>
> should say "I want a return value of type T", not "single_arg_func has a
> return value of type T". Note that the former is the case for T != void,
> because bind will perform an implicit conversion from signal_arg_func's
> return type to T when it returns. When T == void, however, the return type
of
> the bound function object is required to be exactly void -- this seems
> inconsistent to me.

There is no implicit conversion (in this context) from
boost::detail::function::unusable to void. :-) The inconsistency (if there
is one) is in the core language where a void function can return a void but
not something else.

Either way, bind(single_arg_func, 13) will work, as will
bind<function<void>::result_type>(single_arg_func, 13).


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