Jake
Jake

Reputation: 2907

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 capacity.

thanks

Upvotes: 1

Views: 7116

Answers (2)

Xeo
Xeo

Reputation: 131799

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.

Upvotes: 3

Hans Passant
Hans Passant

Reputation: 941545

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.

Upvotes: 4

Related Questions