Boost logo

Boost Users :

From: Daniel Gehriger (gehriger_at_[hidden])
Date: 2007-05-23 16:59:11


I tried BOOST_FOREACH on a slightly modified version of the sample in the
documentation. Instead of iterating by value, I iterate by reference:

extern std::vector<float> get_vector_float();
BOOST_FOREACH( float& f, get_vector_float() )
{
}

When compiling with VisualC++ 8.0, I receive the following error message:

error C2440: 'initializing' : cannot convert from 'const float' to 'float &'
Conversion loses qualifiers

Is there a work-around ?

- Daniel

-- 
View this message in context: http://www.nabble.com/BOOST_FOREACH-and-iterating-by-reference-tf3806531.html#a10772662
Sent from the Boost - Users mailing list archive at Nabble.com.

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