| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"" |
| Date: |
12 Dec 2007 10:29:39 PM |
| Object: |
distance_type vs. size_type for iterator |
Alright, I am sort of confused on c++ iterators having both
distance_type and size_type.
On sgi and Microsoft compiler it uses distance_type for input
iterator. For mingw and cygwin it uses size_type , is it just standard
issues or is it platform dependent.
.
|
|
| User: "Victor Bazarov" |
|
| Title: Re: distance_type vs. size_type for iterator |
13 Dec 2007 07:37:25 AM |
|
|
wrote:
Alright, I am sort of confused on c++ iterators having both
distance_type and size_type.
On sgi and Microsoft compiler it uses distance_type for input
iterator. For mingw and cygwin it uses size_type , is it just standard
issues or is it platform dependent.
The Standard does not require that type 'size_type' is defined for
an iterator (through its traits), it requires 'difference_type',
however (along with 'value_type' and 'iterator_category').
Mingw or cygwin never appeared to me to be especially standard
compliant, they seem to usually contain the compiler or the
library that is simply too old. Just an impression I get.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
| User: "James Kanze" |
|
| Title: Re: distance_type vs. size_type for iterator |
13 Dec 2007 10:34:09 AM |
|
|
On Dec 13, 2:37 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
cablep...@gmail.com wrote:
Alright, I am sort of confused on c++ iterators having both
distance_type and size_type.
On sgi and Microsoft compiler it uses distance_type for input
iterator. For mingw and cygwin it uses size_type , is it just standard
issues or is it platform dependent.
The Standard does not require that type 'size_type' is defined for
an iterator (through its traits), it requires 'difference_type',
however (along with 'value_type' and 'iterator_category').
Mingw or cygwin never appeared to me to be especially standard
compliant, they seem to usually contain the compiler or the
library that is simply too old. Just an impression I get.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
|
|
|
|
| User: "James Kanze" |
|
| Title: Re: distance_type vs. size_type for iterator |
13 Dec 2007 10:43:55 AM |
|
|
On Dec 13, 2:37 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
cablep...@gmail.com wrote:
Alright, I am sort of confused on c++ iterators having both
distance_type and size_type.
On sgi and Microsoft compiler it uses distance_type for input
iterator. For mingw and cygwin it uses size_type , is it just standard
issues or is it platform dependent.
The Standard does not require that type 'size_type' is defined for
an iterator (through its traits), it requires 'difference_type',
however (along with 'value_type' and 'iterator_category').
Mingw or cygwin never appeared to me to be especially standard
compliant, they seem to usually contain the compiler or the
library that is simply too old. Just an impression I get.
I don't know. Before I'd comment, I'd want to know what he
means by "uses size_type for input iterator". The version of
CygWin I have installed here (which isn't the very latest---I
don't use it often enough to bother keeping it up to date) have
g++ 3.3.3, and in std::iterator, it defines difference_type, and
not size_type. The class std::input_iterator_tag doesn't define
any types (which is normal), and there's no other "input
iterator" class that I can think of to which he might be
referring.
And of course, difference_type doesn't have any real meaning for
input and output iterators. You can't obtain a difference at
all for output iterators, and the only way to obtain one for an
input iterator is by incrementing a copy, after which, the
original iterator isn't usable, or doesn't point to where it
originally did.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
.
|
|
|
|
|

|
Related Articles |
|
|