Boost logo

Boost :

Subject: Re: [boost] [reference_wrapper] Overloading operator() in reference_wrapper
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2013-05-02 03:08:31


2013/5/2 Kazutoshi Satoda <k_satoda_at_[hidden]>

> 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.
>

Isn't it possible to provide operator() and allow T to be incomplete as
long as operator() isn't used?

Regards,
Kris


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