|
Boost Users : |
Subject: Re: [Boost-users] [Bind] How to bind?
From: Max (loadcom_at_[hidden])
Date: 2009-01-03 09:21:09
Should I use a seperate functor like this?
template<class T>
struct dereference : public std::unary_function<T*, T>
{
T operator()(T *pt) { return *pt; }
};
A a;
boost::bind(&processA, boost::bind(dereference<A>(), _1))(&a);
If the answer is yes, is there a safer and stronger equivalence
of "dereference" in boost?
Thanks again.
B/Rgds
Max
======================================
Hello
On simple question:
For
struct A {};
void processA(A& a) {}
A *pa = new A();
How to write a bind expression that make
(pa);
equivalent to
processA(*pa);
I've tried with this:
boost::bind(&processA, *_1)
but failed.
I've also tried with this:
processA(*boost::lambda::_1)
also failed.
Thanks for any information.
B/Rgds
Max
-------------------------------------------------------------------
ÐÂÀ˿ռ䡪¡ªÓëÅóÓÑ¿ªÐÄ·ÖÏíÍøÂçÐÂÉú»î£¡(http://space.sina.com.cn/ )
-------------------------------------------------------------------
ÐÂÀ˿ռ䡪¡ªÓëÅóÓÑ¿ªÐÄ·ÖÏíÍøÂçÐÂÉú»î£¡(http://space.sina.com.cn/ )
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net