Boost logo

Boost Users :

Subject: [Boost-users] [lambda] how to get rid of the reference argument in lambda functor?
From: Pobinger Gerhard Stefan (GerhardStefan.Pobinger_at_[hidden])
Date: 2009-04-09 04:26:26


Hi *,

I was desparately trying to compile something like this (VS2008), always getting the error that it cannot convert from int* to int*&.

:boost::shared_ptr<int> c;
::boost::lambda::var(c)
=::boost::lambda::constructor
<::boost::shared_ptr<int>>()
(::boost::lambda::new_ptr<int>()()
)

[This is "short form" for the conventional code
::boost::shared_ptr<int>c=::boost::shared_ptr<int>(new int());] (1)

The reason is that all lambda functors take arguments by reference. In this case, make_const in front of shared_ptr did not solve the problem, it causes immediate evaluation of the new_ptr functor...

Is there any way to rewrite this (1) short line of code in boost-lambda?

/Gerhard Pobinger



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