Boost logo

Boost :

From: tamboril_at_[hidden]
Date: 2001-08-09 09:48:11


In using compose_f_gx_hx<> with my own unary_function object, it
doesn't compile due to the well-known "reference-to-reference" issue.

Specifically, the code (from compose.hpp):

    // function call
    typename OP1::result_type
    operator()(const typename OP2::argument_type& x) const {
        return op1(op2(x),op3(x));
    }

unconditionally adds 'const' and '&' to an argument_type which, for
my unary function class is *already* (and correctly, I think) a const
reference (see below).

Don't the compose functions need some type_traits religion?

My function object:
struct IsNamed : public std::unary_function<const ElementNode&, bool>
{
    IsNamed(const std::string& nm_) :nm(nm_) {}
    bool operator()(const ElementNode& el_) const
    {return el_.Get().name == nm;}
    private: std::string nm;
};

john harris
trading technologies


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