std::tr1::array - What's the difference between max_size and size?

S

Sarath

From the documentaiton, I could not find any difference between these
functions.

std::tr1::array - What's the difference between max_size and size?

Thank you.

-Sarath
 
S

SG

From the documentaiton, I could not find any difference between these
functions.

std::tr1::array - What's the difference between max_size and size?

Thank you.

-Sarath

Good question. It's not explained in the draft
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf

But max_size probably returns the maximum number of elements that can
be stored in this container. Since array is a fixed-size container I
would guess that the resulf of array<T,N>::max_size() equals
array<T,N>::size().

Cheers!
SG
 
K

Knockr

STL containers in general provide both member functions. size() tells
you how many elements there are currently in the container, and
max_size() gives you an estimate of the maximum number of elements that
you could put into the container.

For array, both values are the same.

--
   Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of
"The Standard C++ Library Extensions: a Tutorial and Reference"
(www.petebecker.com/tr1book)

Thanks Pete and SG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top