Friday, 15 March 2013

expected unqualified-id before ‘{’ token in boost example -



expected unqualified-id before ‘{’ token in boost example -

i picked (ie copy-pasted) next illustration boost documentation (http://www.boost.org/doc/libs/1_55_0b1/libs/assign/doc/index.html#operator+=):

#include <boost/assign/std/vector.hpp> // 'operator+=()' #include <boost/assert.hpp> using namespace std; using namespace boost::assign; // bring 'operator+=()' scope { vector<int> values; values += 1,2,3,4,5,6,7,8,9; // insert values @ end of container boost_assert( values.size() == 9 ); boost_assert( values[0] == 1 ); boost_assert( values[8] == 9 ); }

which throws next error:

$ g++ boost_assign.cpp boost_assign.cpp:6:1: error: expected unqualified-id before ‘{’ token { ^

what's wrong ? boost examples not straight copy-paste-run-able ?

those examples not copy-paste-run-able. code enclosed in braces needs pasted somewhere in function.

boost

No comments:

Post a Comment