|
Boost Users : |
From: Jaakko Jarvi (jajarvi_at_[hidden])
Date: 2002-09-18 10:24:49
Hi,
> Does the lambda library compile under mingw with gcc 2.95.2?
> I'm a newbie and I can't figure out what's wrong with the following test example:
It's a compiler bug. Works with gcc 2.96 and upwards.
The bind syntax has been extended after Peter Dimov's bind library
to support binding of member variables, and this seems to work with 2.95.2
This feature is not in release 1.28 of boost, but will be in 1.29
Form lambda docs (in CVS)
--------------------------------
5.3.3. Member variables as targets
A pointer to a member variable is not really a function, but the first
argument to the bind function can nevertheless be a pointer to a member
variable. Invoking such a bind expression returns a reference to the data
member. For example:
struct A { int data; };
A a;
bind(&A::data, _1)(a) = 1; // a.data == 1
-----------------------------------
Cheers, Jaakko
> > #include
<boost/lambda/bind.hpp>
> #include <boost/lambda/lambda.hpp>
> using namespace boost;
> using namespace boost::lambda;
>
> struct A { int d; };
>
> int main (int argc, int argv[])
> {
> A* a = new A();
> int b = (a ->* &A::d);
> int c = (_1 ->* &A::d)(a);
> return c - b;
> }
>
>
> g++ test.cpp -Wall -Ix:/boost_1_28_0/ -D__PROCESSOR_X86__ -D__WIN32__ -D__GCC__
> -o test.o
> test.cpp: In function `int main(int, int *)':
> test.cpp:12: no match for `const boost::lambda::lambda_functor<boost::lambda::pl
> aceholder<1> > & ->* int A::*'
> make: *** [test.exe] Error 1
>
>
> Would appreciate any clues. ;-)
>
> Mynhard
>
>
>
>
>
>
>
> Info: <http://www.boost.org>
> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
> Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
-- -- -- Jaakko Järvi email: jajarvi_at_[hidden] -- Post Doctoral Fellow phone: +1 (812) 855-3608 -- Pervasive Technology Labs fax: +1 (812) 855-4829 -- Indiana University, Bloomington
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