I migrate my project from VC++ 2015 to VC++ 2017. I have my own implementation of iterator. It has forward-only operations set:
template <class Container>
struct NodeTableIterator
{
typedef NodeTableIterator<Container> this_t;
this_t& operator ++();
this_t operator ++(int);
};
Somewhere in code I use it for std::copy
std::copy(tbl.begin(), tbl.end(),
std::ostream_iterator<int>(std::cout, ", "));
This line perfectly worked in VC++2015 but fails in 2017 just because:
error C2784: 'unknown-type std::operator -(const std::move_iterator<_RanIt> &,const std::move_iterator<_RanIt2> &)': could not deduce template argument for 'const std::move_iterator<_RanIt> &' from 'const NodeTableIterator...'
Simple inspection inside std::copy shows this source of error:
const auto _UDest = _Unchecked_n(_Dest, _Idl_distance<_InIt>(_UFirst, _ULast));
Where _Idl_distance really expects that my iterator should support operator -.
Have you any idea how to overcome this strange requirement?