How to write a method that takes a general iterator as input argument? Now I have a bunch of these methods ( you can tell how ugly it looks like):

void ConvertUtility::ConvertEdgeIndexList(const list&lt;EdgeIndex&gt; &amp;edgeIndex)
{

     list&lt;EdgeIndex&gt;::const_iterator sit;
     for(sit=edgeIndex.begin(); sit!=edgeIndex.end(); sit++)
     {

     }
}


void ConvertUtility::ConvertEdgeIndexList(const vector&lt;EdgeIndex&gt; &amp;edgeIndex)
{

     vector&lt;EdgeIndex&gt;::const_iterator sit;
     for(sit=edgeIndex.begin(); sit!=edgeIndex.end(); sit++)
     {

     }
}


Is there anyway I can aggregate these two functions into one single function?
How about:

template&lt;typename C&gt;
void ConvertUtility::ConvertEdgeIndexList(C const&amp; edgeIndex)
{
     typename C::const_iterator sit;
     for(sit=edgeIndex.begin(); sit!=edgeIndex.end(); ++sit)
     {                                      //        ^^ Prefer pre-increment on iterators.

     }
}


PS. Stackoverflow may be a better site for this type of question.