
::basic_ios(const std::basic_ios
&)': /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/ios_base.h:781: error: `std::ios_base::ios_base(const std::ios_base&) ' is private junk.cpp:17: error: within this context junk.cpp: In function `int main()': junk.cpp:17: error: initializing argument 3 of `_Function std::for_each(_InputIterator, _InputIterator, _Function) [wi
I have a little code snippet...
#include <iostream>
#include "boost/range.hpp"
#include "boost/function.hpp"
#include "boost/lambda/lambda.hpp"
int main( )
{
using namespace boost::lambda;
typedef int block[2][4];
boost::function< int(boost::range_value< block >::type) > third = _1[2];
block values = {{0,1,2,3},{4,5,6,7}};
std::for_each(boost::begin(values), boost::end(values),
std::cout << third << "\n" );
}
which I want to print the third element of each row of values. I can see
that
what I've written is not quite right, since the compiler quite reasonably
complains
that it doesn't kknow how to print a function object, but I can't seem to
write the correct incantation! The error message, if it helps is...
$ g++ -o junk.exe junk.cpp
junk.cpp: In copy constructor `std::basic_ios