hi, I've got a question regarding the compose_f_gx function object. I tried to use it in combination with this small example. class Element { public: explicit Element(int nVal) : m_nValue(nVal) {} const int getValue() const { return m_nValue; } private: int m_nValue; }; Element el(3); // a == true; bool a = bind<bool>(equal_to<int>(), _1, 3)(3); // b == 3; int b = mem_fn(&Element::getValue)(el); // c == true bool c = bind<bool>(equal_to<int>(), _1, 3) (mem_fn(&Element::getValue)(el)); // d should also be true, but does not compile bool d = compose_f_gx(bind<bool>(equal_to<int>(), _1, 3), mem_fn(&Element::getValue))(el); The last line does not compile. I don't know why. So what's wrong? thanks, andreas
pirx wrote:
hi,
I've got a question regarding the compose_f_gx function object. I tried to use it in combination with this small example.
[...]
// d should also be true, but does not compile bool d = compose_f_gx(bind<bool>(equal_to<int>(), _1, 3), mem_fn(&Element::getValue))(el);
bool d = bind<bool>(equal_to<int>(), bind(&Element::getValue, _1), 3)(el); See http://www.boost.org/libs/bind/bind.html#nested_binds http://www.boost.org/libs/bind/bind_as_compose.cpp
participants (2)
-
Peter Dimov
-
pirx