|
Boost : |
Subject: [boost] [iterator] Re: counting_iterator<int>::difference_type
From: Arno Schödl (aschoedl_at_[hidden])
Date: 2010-04-13 06:14:23
> > 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.
> You are able to override the difference_type by providing your own type.
> See:
> boost::counting_iterator<int,boost::use_default,int>::difference_type
I know and I did it already. I just want to question whether the default is sensible, given the rest of the language.
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