I'm having such two typedefs:
typedef std::vector<int> Container;
typedef std::vector<int>::const_iterator Iter;
In the problem that I consider, I perform some operations on Container Input
, and after that I would like to compute std::distance(Input.begin(),itTarget)
, where itTarget
is of the Iter
type. But I'm getting this compiler error that no instance of function template "std::distance" matches the argument list
, and only after casting, i.e., std::distance(static_cast<Iter>(Input.begin()),itTarget)
everything works fine.
I wonder why is that?