I am reading STL tutorial at following link
http://cs.brown.edu/people/jak/proglang/cpp/stltut/tut.html
How to fix compilation error?
Here following code is mentioned
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <iostream>
#include <iterator>
using namespace std;
template <class ForwardIterator, class T>
void iota_n (ForwardIterator first, int n, T value)
{
for (int i = 0; i < n; i++) {
*first++ = *value++;
}
}
void main ()
{
vector<int> v;
iota_n (v.begin(), 100, back_inserter(v));
random_shuffle (v.begin(), v.end()); // shuffle
copy (v.begin(), v.end(), ostream_iterator<int> (cout, "\n")); // print
}
While compiling facing following error.
error C2440: '=' : cannot convert from 'std::back_insert_iterator<_Container>' to 'int'