Boost logo

Boost :

Subject: [boost] counting_iterator<int>::difference_type
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2010-04-13 03:32:12


Hello,

 

I am sure this has come up a few times, but I could not find the answer in the archive.

 

counting_iterator<int>::difference_type is __int64 by default. I understand the underlying rationale, but I am not sure whether it is the right choice given the existing practice of C/C++. The problem of int minus int overflowing is not restricted to counting_iterator. Still, C/C++ chose to make int minus int -> int, probably for performance reasons. So why shouldn't counting_iterator by default behave the same way? If someone needs something else, she can still override the default.

 

Arno

--
Dr. Arno Schoedl · aschoedl_at_[hidden] 
Technical Director 
 
think-cell Software GmbH · Chausseestr. 8/E · 10115 Berlin, Germany 
http://www.think-cell.com · phone +49 30 666473-10 · toll-free (US) +1 800 891 8091
Directors: Dr. Markus Hannebauer, Dr. Arno Schoedl · Amtsgericht Berlin-Charlottenburg, HRB 85229

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk