I would like to know how to pass a const_iterator to a template. For example in the below call and function template.
The iterator for first1 and last 1 is
std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::iterator
and the iterator for first2 and last2 is const_iterator
std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::const_iterator
template < typename T>
T my_function(T __first1, T __last1, T __first2, T __last2, T __result)
{
}
Call is
my_function(co1.begin(), co1.end(), co2.begin(), co2,end(), result.begin());
Is there a way to pass both a normal iterator and a const_iterator in a single template?
The error is
error: no matching function for call to ‘my_function(std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::iterator, std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::iterator, std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::const_iterator, std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::const_iterator, std::vector<std::pair<cv::Point_<float>, cv::Point_<float> > >::iterator)’’
my_function(co1.begin(), co1.end(), co2.begin(), co2.end(), result.begin());