I overloaded operator << for STL map successfully:
template <typename T1, typename T2ostream & operator << (ostream &
o, map <T1,T2& m)
{
//code
}
the code works like a charm. Now, I want the same functionality for
multimap. Since their interface is same for the problem at hand, I
want to make collection name a template parameter like this:
template <typename MAP, typename T1, typename T2ostream & operator
<< (ostream & o, MAP<T1,T2& m)
{
//code
}
The compiler errors like this: syntax error : missing ')' before '<'
thx,
ozi.
template <typename T1, typename T2ostream & operator << (ostream &
o, map <T1,T2& m)
{
//code
}
the code works like a charm. Now, I want the same functionality for
multimap. Since their interface is same for the problem at hand, I
want to make collection name a template parameter like this:
template <typename MAP, typename T1, typename T2ostream & operator
<< (ostream & o, MAP<T1,T2& m)
{
//code
}
The compiler errors like this: syntax error : missing ')' before '<'
thx,
ozi.
Comment