Given this piece of code:
#include
(void) someFunction(void) {
list l;
l.push_back(1);
}
Where are the elements of the list stored? Stack? Heap?
The elements held by the list are typically dynamically allocated so this will be on the heap.
This function can returns the list?
No it cannot, you declared your function with a return type of void.
How can I do to empirically check that values are in stack or heap?
The only way to be really sure is to peek into the std::list implementation to see what it's really doing. But you don't really need to care about this since it's an implementation detail.