Error compiling with g++ 3.4.4
The code below compiles and runs perfectly in Windows XP Pro, Using MS
VS 2005.
If I compile with g++ (cygwin) using the following command line:
g++ -pedantic -Weffc++ -Wall -Wctor-dtor-privacy -Wold-style-cast -
Woverloaded-virtual -o kk kk.cpp
it displays the following errors:
kk.cpp: In function `void Burp(std::ostream&,
std::vector<std::vector<T, std::allocator<_CharT> >,
std::allocator<std::vector<T, std::allocator<_CharT> > > >&)':
kk.cpp:15: error: expected `;' before "ite"
kk.cpp:15: error: `ite' undeclared (first use this function)
kk.cpp:15: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Any help is appreciated, Thanks.
CODE:
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdexcept>
#include <iterator>
using namespace std;
template <typename T>
void Burp(ostream& os, vector< vector<T> >& vec)
{
os << "Our vector of vectors" << endl;
for(vector< vector<T> >::iterator ite = vec.begin(); ite!=
vec.end();ite++)
{
copy((*ite).begin(), (*ite).end(), ostream_iterator<T>(os, " "));
os << endl;
}
os << "/Our vector of vectors" << endl;
}