
Geometry : 
Subject: [geometry] for_each_point( ) and lambdas
From: Vladimir Petrovic (vpetrovic_at_[hidden])
Date: 20121106 11:34:23
Hi,
I'm trying to use the following code (boost 1.51.0) under Microsoft VC
11:
boost::geometry::for_each_point( *this, [size](_TPoint<T>& pt) { pt +=
size; } );
The compiler gives an error that lambda type doesn't have operator=:
error C2582: 'operator =' function is unavailable in
'_TPolygon<T>::+=::<lambda_69d206a82fa912fef2170aefa862d180>'
boost_1_51_0\boost\geometry\multi\algorithms\for_each.hpp 54
The problem is in the for_each.hpp:
struct for_each_multi
{
static inline Functor apply(
typename add_const_if_c<IsConst,
MultiGeometry>::type& multi,
Functor f)
{
for(BOOST_AUTO_TPL(it, boost::begin(multi)); it !=
boost::end(multi); ++it)
{
f = Policy::apply(*it, f);
}
return f;
}
};
The code tries to assign to functor: f = Policy::apply(*it, f);
It seems correct to me that VC doesn't allow operator= for lambdas. On
the other hand, it's natural to use lambda with for_each_point( ). Is
there any other way to use for_each_point() or something similar with
funktor which doesn't have operator= (like lambda) ?
best regards,
Vladimir
 Vladimir Petrovic  vpetrovic_at_[hidden] thinkcell Software GmbH  Chausseestr. 8/E  10115 Berlin  Germany http://www.thinkcell.com  phone +49 30 66647310  US phone +1 800 891 8091 Amtsgericht BerlinCharlottenburg, HRB 85229  European Union VAT Id DE813474306 Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl
Geometry list run by mateusz at loskot.net