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:
(snip)
> 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.
https://groups.google.com/a/isocpp.org/d/msg/std-discussion/_tavlfXkOrc/wIxT3VShJzMJ

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.
http://www.boost.org/doc/libs/1_53_0/libs/tuple/doc/tuple_users_guide.html#make_tuple

What do you think?

-- 
k_satoda

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