What is the difference between size_t and size_type? size_type seems to be related closely with the C++ Standard String Class. Couldn't they have just used size_t instead? I don't understand the difference. Could anyone elaborate please?
Frederick2 189 Posting Whiz
Recommended Answers
Jump to PostCouldn't they have just used size_t instead?
Sure, but there were two reasons to define size_type:
- Support custom allocators and different memory management strategies without forcing code changes.
- Historically, size_type was added to the STL implementation to deal with a problem on the Intel architecture (no, I don't know …
All 3 Replies
MosaicFuneral 812 Nearly a Posting Virtuoso
Narue 5,707 Bad Cop Team Colleague
Frederick2 189 Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.