This question got me thinking about the max_size method in vector class. It is quite apparent that practically the number of elements contained in the vector will be much lesser than what max_size returns. So I was wondering where this will be useful? Any clues?
This question got me thinking about the max_size method in vector class. It is
Share
It really isn’t very useful.
The only theoretical usage would be to check that if you need a container larger than
max_size(), you are in trouble. But you would probably realize that already when considering a port of your database server to a microwave oven.The committee once considered improving the function, but didn’t find it useful enough to be worth a change:
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-closed.html#197