Boost logo

Boost :

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

From: <scleary_at_[hidden]>
> The following simple code fails to compile on Borland 5.5.1 (patch 2):
> #include <boost/function.hpp>
> #include <boost/bind.hpp>
> using boost::function;
> using boost::bind;
> int main()
> {
> function<void, int> single_arg_func;
> function<void> no_arg_func = bind<void>(single_arg_func, 13);
> return 0;
> }
> The error message seems to indicate that BCB doesn't fully support void
> returns (it does appear to support it in some contexts, though...)

There is nothing wrong with the compiler; the problem is caused by
boost::function<void, ...>'s void return workaround. It substitutes void
with boost::detail::function::unusable.

If you use bind(single_arg_func, 13), without the '<void>', it will work (on
partial-* compilers.) If you want to use the explicit syntax, the correct
return type is 'boost::detail::function::unusable'.

Incidentally, this example warns that boost::detail::empty_helper_t1<T> (in
type_traits/object_traits.hpp) doesn't have a constructor and therefore
cannot be instantiated.

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