Re: size_t and size_type
From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/01/04
- Next message: Denis Remezov: "Re: size_t and size_type"
- Previous message: Min,Lee: "Re: why 80 charachters??"
- In reply to: Grumble: "size_t and size_type"
- Next in thread: Pete Becker: "Re: size_t and size_type"
- Reply: Pete Becker: "Re: size_t and size_type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 01 Apr 2004 15:55:15 GMT
On Thu, 01 Apr 2004 16:17:54 +0200, Grumble <invalid@kma.eu.org> wrote:
>What is the difference between size_t and vector<T>::size_type?
This should really be in the FAQ.
Bottom line: /probably/ none. The Standard explicitly allows container
implementors to assume that the allocators they're handed (from which the
size_type typedef may be propagated to the clients of the container,
although I have library implementations that just hard-wire size_t for the
container typedefs) define size_type as size_t. Extensions are also
permitted (see 20.1.5/4).
>
>Are they ever a different type or a different size?
If there are any such implementations, I don't know about them yet.
>
>Why should one type the latter when the former is shorter?
Either they were thinking ahead to some scenario when containers' memory
would come from some heap with totally different rules of memory management
that needed its own unique size_type, or else this is just an artifact of
the Intel segmented architecture memory-model that influenced the creation
of allocators in the first place. Who knows...
>
>What about the size_type type in other STL classes?
Same deal, AFAIK.
-leor
-- Leor Zolman --- BD Software --- www.bdsoft.com On-Site Training in C/C++, Java, Perl and Unix C++ users: Download BD Software's free STL Error Message Decryptor at: www.bdsoft.com/tools/stlfilt.html
- Next message: Denis Remezov: "Re: size_t and size_type"
- Previous message: Min,Lee: "Re: why 80 charachters??"
- In reply to: Grumble: "size_t and size_type"
- Next in thread: Pete Becker: "Re: size_t and size_type"
- Reply: Pete Becker: "Re: size_t and size_type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|