Is There an Example of an Iterator Which Wouldn't use ptrdiff_t as its difference_type?

  • A+
Category:Languages

I see that iterator_traits always defines a difference_type: https://en.cppreference.com/w/cpp/iterator/iterator_traits#Member_types

I'm just wondering why, wouldn't that be ptrdiff_t for every type? Is there an example of an iterator which doesn't use ptrdiff_t? And if not why isn't difference_type eliminated from iterator_traits and ptrdiff_t used everywhere?

 


I wrote a rope type that can deal with backing store greater than potential memory (that is, it can deal with 64-bit sequences even in 32-bit code). And so I had to use 64-bit size and difference types regardless of whether it was being compiled in 32 or 64 bit mode.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: