AMDG Pobinger Gerhard Stefan wrote:
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>()() )
I don't think that you want to evaluate new_ptr<int>() immediately.
Try this (removing namespaces for clarity)
(var(c) = constructor
[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?
In Christ, Steven Watanabe