HI guys

I am using STL map in one of my project . I want to limit my size of my STL map size based on the use input , how do i do it .

For Example : if the user types in 5 as input then my program should be able to insert only 5 elements into my map not more that that . Hodo i do such allocation. Thanks

u can do that by keeping a counter or as follows:

class mymap
     map<.....>  m;
     int maxsize=5;//say

/*if(m.size()<maxsize)       then only do more addition to it. Else dont.*/