Below is my code
template<typename iterator>
void selSort(iterator begin, iterator end)
{
iterator minIt = begin;
iterator it2 = begin + 1;
for(iterator it = begin; it != end; ++it)
{
minIt = it;
for(; it2 != end; ++it2)
{
if(*it2 < *minIt)
*minIt = *it2; //line X
}
std::swap(it2, minIt);
}
}
i am reading the book--"The C++ Standard Library -
A Tutorial And Reference (1999)"(haven't finished it yet)
I quite wonder how could the std::sort is possible?
At line X, befoure I overwrite the value of *it2 to *minIt
I have to save the value of *minIt
But I don't know how to declare a variable to save the value
of *minIt, do you have any ideas to solve this?
Thanks a lot