|
Boost Users : |
Subject: Re: [Boost-users] [Bind] How to bind?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-03 12:01:46
AMDG
Max wrote:
> 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 you're using Boost.Bind, yes, although it might be better for
dereference to return a
reference.
> If the answer is yes, is there a safer and stronger equivalence
> of "dereference" in boost?
>
Boost.Lambda allows dereference.
> I've tried with this:
>
> boost::bind(&processA, *_1)
> processA(*boost::lambda::_1)
>
A slight variation should work:
boost::lambda::bind(&processA, *boost::lambda::_1)
In Christ,
Steven Watanabe
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