Boost logo

Boost :

Subject: Re: [boost] [reference_wrapper] Overloading operator() in reference_wrapper
From: Kazutoshi Satoda (k_satoda_at_[hidden])
Date: 2013-05-02 00:26:23

On 2013/04/09 16:24 +0900, Nathan Crookston wrote:
> std::reference_wrapper includes an overload of operator()[1] which allows a
> wrapped function object to be called without needing to first unwrap:
> I think it would be valuable to update boost::ref to match the standard
> version.

Is it OK to require the template argument to be a complete type?

The standard version requires complete type for operator() support,
which results in sticking on the boost version for some cases.

I think it's better to have two; std::reference_wrapper which has
operator() but requires complete types, and boost::reference_wrapper
which allows incomplete types but doesn't have operator(), and users can
choose between them for their purpose.

It can be said as a compatibility problem between older versions of
boost. If the new behavior (compile error on incomplete types) was
reported as a bug, is it reasonable to just reject? I think it is
unreasonable because ref() and cref() can be used to make a tuple with
reference members where incomplete types might be expected and
operator() is completely irrelevant.

What do you think?


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