map::max_size function


To get the maximum size allocated by the compiler for the container to store the elements use the function map::max_size.

size_t max_size() const;

Parameters:
none

Return type
size_t -The maximum size the compiler can allocate for storing elements.

Note the maximum size returned is compiler dependent.Running the code below in Code::blocks and Visual Studio will give different results.

Code example

map<int,double> m{ {34 , 89.277} };

cout<< m.max_size() ;

In code::blocks
Output : 461168601842738790

In Visual Studio
Output: 89478485


 


Stop wasting time,earn money($$$) from your website-Join Now!