Maximum capacity of STL queue
What is the maximum capacity of an STL queue, considering that it holds ints. By maximum capacity I mean the max number of integers it can hold at maximum capacit开发者_Python百科y.
thanks
There's a big difference between theoretical maximum as returned by queue::max_size() and actual maximum. You probably only ever really care about the latter, but there's no way to find out until it is too late. It heavily depends on the state of the heap and the virtual memory address space.
C++ Reference holds an answer for that.
In the end, it relies on the underlying container of std::queue
. Its max_size
is also the max_size
of the queue.
精彩评论