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 Postsize_type is just a typedef of size_t in STL containers. For a %100 compatibility, you may want to use size_type, but for the most part it's interchangeable, unless you're following the standard.
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.