Boost logo

Boost :

From: shunsuke (pstade.mb_at_[hidden])
Date: 2008-04-07 14:46:37


Eric Niebler wrote:
> What I'm saying is that, in C++03, polymorphic function objects are
> broken, so we need the runtime equivalent of a metafunction class ... a
> generator for monomorphic function objects. Call it a function class:
>
> struct fun_class
> {
> template<typename A>
> struct apply
> {
> typedef ... result_type;
> result_type operator()(
> typedef add_const_ref<A>::type a
> ) const
> {
> return ...;
> }
> };
> };
>
> Now both the return type calculation *and* the operator() have access to
> *all* the information about the arguments, even their lvalue/rvalue-ness.

After all, if you need "overload on rvalueness" in C++03,
some workaround is needed.

BTW, this doesn't need a new concept:
   foo(i, boost::rval(3));
I don't like it of course, though. :-)

Regards,

-- 
Shunsuke Sogame

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