Hi,
this is what I'm trying to dor:
Code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <boost/lambda/lambda.hpp>
using namespace std;
void func(vector<char>::const_iterator start, vector<char>::const_iterator end)
{
for_each(start, end, cout << boost::lambda::_1 << " ");
}
int main()
{
vector<char> v;
v.push_back('A');
v.push_back('B');
v.push_back('C');
func(v.begin(), v.end()); // prints "A B C"
cout << endl;
func(v.rbegin(), v.rend()); // error C2664: 'func' : cannot convert
//parameter 1 from 'std::reverse_iterator<_RanIt>' to 'std::_Vector_const_iterator<_Ty,_Alloc>'
cout << endl;
}
I've never used reverse iterating so far. How would I have to change the example so the vector gets printed out in reverse (without changing func) like "C B A"?
Thank you in advance!