
Thanks for the input on trying to use boost::lambda::bind instead of boost::bind, unfortunately there is no bind in the lambda namespace. I'm using Boost 1.35, and in my version "namespace lambda" only exists in boost\lambda\construct.hpp and only contains a single templated struct constructor, there is no bind available :( Any ideas? I'm trying all sort of funny syntax variations to no avail... Message: 4 Date: Fri, 13 Jun 2008 15:37:58 -0700 From: "albert meyburgh" <ameyburgh@gmail.com> Subject: [boost] Constructor with parameters -- Lambda To: boost@lists.boost.org Message-ID: <35f053b10806131537o4b85769fg84a88bc0c70dddc4@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Hi, I'm trying to use the lambda constructor provided in boost and it's not compiling. class someclass { someclass(sometype, int x) } std::vector v<sometype> std::vector v2<someclass> std::transform( v.begin(), v.end(), std::back_inserter( v2 ), boost::bind( boost::lambda::constructor<someclass>(), _1, 5) ); // where 5 is a constant int parameter for x to the constructor Resulting in Error 1 error C2039: 'result_type' : is not a member of 'boost::lambda::constructor<T>' boost_1_35_0\boost\bind.hpp 67 Error 2 error C2146: syntax error : missing ';' before identifier 'type' boost_1_35_0\boost\bind.hpp 67 Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int boost_1_35_0\boost\bind.hpp 67 Error 4 error C2208: 'boost::_bi::type' : no members defined using this type boost_1_35_0\boost\bind.hpp 67 Error 5 fatal error C1903: unable to recover from previous error(s); stopping compilation boost_1_35_0\boost\bind.hpp 67 What is wrong with my syntax? ------------------------------ Message: 5 Date: Fri, 13 Jun 2008 15:57:59 -0700 From: Steven Watanabe <watanabesj@gmail.com> Subject: Re: [boost] Constructor with parameters -- Lambda To: boost@lists.boost.org Message-ID: <4852FB77.4000902@providere-consulting.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed AMDG albert meyburgh wrote:
boost::bind( boost::lambda::constructor<someclass>(), _1, 5) ); // where 5 is a constant int parameter for x to the constructor
Use boost::lambda::bind. In Christ, Steven Watanabe ------------------------------ Message: 6 Date: Fri, 13 Jun 2008 15:59:14 -0700 From: Eric Niebler <eric@boost-consulting.com> Subject: Re: [boost] Constructor with parameters -- Lambda To: boost@lists.boost.org Message-ID: <4852FBC2.8040606@boost-consulting.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed albert meyburgh wrote:
Hi,
I'm trying to use the lambda constructor provided in boost and it's not compiling.
class someclass { someclass(sometype, int x) }
std::vector v<sometype> std::vector v2<someclass> std::transform( v.begin(), v.end(), std::back_inserter( v2 ), boost::bind( boost::lambda::constructor<someclass>(),
Try boost::lambda::bind() instead of boost::bind(). -- Eric Niebler BoostPro Computing http://www.boostpro.com