|
Boost Users : |
Subject: Re: [Boost-users] [boost][container][static_vector] Stack or heap?
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2014-09-08 13:28:41
2014-09-08 19:06 GMT+02:00 Aaron Levy <aaron.levy_at_[hidden]>:
> Does the boost::container::static_vector allocate its memory on the stack
> or heap.
Same as plain old int - where does int allocate its memory? It does not
allocate. It just resides wherever you define it to be.
The memory for elements of static_vector is inside the static_vector object
itself. When you put your object on the stack, the memory is on the stack.
> From what I could make of the code, it seems to allocate on the stack.
> What happens if the requested size exceeds the stack size limits?
>
> Aaron
>
When an object doesn't fit on the stack (no matter if it's a static_vector
instance or a plain old int), you typically get a stack overflow error and
your program crashes.
HTH,
Kris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net