Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-07 12:42:29

From: "Douglas Gregor" <gregod_at_[hidden]>
> On Sunday 07 October 2001 10:42, you wrote:
> > That said, this decision is not set in stone. Are void returns on MSVC 6
> > killer feature? Keep in mind that MSVC 7 supports them.
> I would suggest that the 'void returns' workaround always be present, even
> the compiler supports void returns. Then not only will this work:
> struct f { void operator()(int) const; };
> bind<void>(f(), _1);
> But also one can have:
> struct g { int operator()(int) const; };
> bind<void>(g(), _1);
> So effectively bind can be asked to ignore a return value.

Yes, the workaround has design implications, as you note. But: why would you
want to ask bind to ignore a return value?

> Function does
> this, so "boost::function<void, int>(g()))" is valid and will swallow the
> result of "g" when called. I believe Jesse Jones had a very good argument
> this behavior (it swayed me, at least), though I wasn't able to find it in
> the archives.

I have a very good argument for this behavior, too; but it doesn't seem to
apply to bind equally well.

Peter Dimov
Multi Media Ltd.

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