I have the following template class.
template <typename _Type, typename _Comparator = equal_to<_Type> >
class CSearch
{
...
};
It should store STL stuffs like list, set or string. I store all elements (for example strings) in private class member:
map<int,_Type> seqs;
Now I want to use iterator, but there is a problem with <_Type>::const_iterator.
template <typename _Type, typename _Comparator>
void CSearch<_Type,_Comparator>::Foo1(int id, const _Type & needle)
{
seqs.insert(make_pair(id,needle));
for(_Type::const_iterator it=seqs[0].begin();it!=seqs[0].end();it++)
cout<<*it<<" ";
cout<<endl;
}
or analogically
for(map<int,_Type>::const_iterator it=seqs.begin();it!=seqs.end();it++)
cout<<*it<<" ";