ok everyone, I have another stupid question...
what's wrong with this function implementation?
Code:
#include <map>
#include <iterator>
#include <iostream>
#include <fstream>
using namespace std;
template <typename keyType, typename valueType>
void display(map<keyType, valueType> &words_for_query, ostream &ofile=cout)
{
map<keyType, valueType>::const_iterator istart = words_for_query.begin(); iend = words_for_query.end();
for ( ;istart != iend; istart++)
ofile << istart->first << ": " << istart->second << "\n";
}
I use g++ to compile it. and the error report is:
test.cpp:12: error: expected `;' before ‘istart’
test.cpp:13: error: ‘iend’ was not declared in this scope
test.cpp:14: error: ‘istart’ was not declared in this scope
completely noob to c++, any help and suggestion appreciated!