std::string myVar;
Is the maximum character myVar
can hold is dictated by stack or heap?
By default, the memory allocated for std::string
is allocated dynamically.
Note that std::string
has a max_size()
function returning the maximum number of character supported by the implementation. The usefulness of this is questionable, though, as it's a implementation maximum, and doesn't take into consideration other resources, like memory. Your real limit is much lower. (Try allocating 4GB of contiguous memory, or take into account memory exhaustion elsewhere.)