Boost logo

Boost :

From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-05-13 12:29:53


AMDG

Marco Costalba wrote:
> BTW MSF implementation _really_ needs set() and not only operator=(),
> because for SFINAE to work I need an additional (hidden) argument for
> each assignment call. Indeed if you look at overload.hpp, operator=()
> implementation is just:
>
>
> template<typename Fun>
> function& operator=(Fun const& f)
> {
> this->set(f);
> return *this;
> }
>
> And set() is a public method so it is usable directly by the user.
>
>

For everything but constructors, you can use SFINAE on the return type.

template<typename Fun>
typename boost::enable_if<..., function&>::type operator=(Fun const& f);

In Christ,
Steven Watanabe


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