Sort of. You have correctly asserted when 'vect' is on the heap or on the stack, but from what I know of my compilers implementation of std::vector all of them will be allocated on the heap - the only difference being that for the last example you will have pointers to objects on the heap allocated on the heap. I may be wrong though, or this might be compiler dependent, its normally not a good idea to get too deep into the innards of the standard library.
#include <iostream>
#include <vector>
int main()
{
std::vector<double> vec(1000) ; // vector of 1000 doubles
std::cout << "object 'vec' takes up " << sizeof(vec) << " bytes "
<< "at address " << std::addressof(vec)
<< "\nit has an automatic storage duration (typically placed on the runtime-stack)\n" ;
std::cout << "\nthe " << vec.size() << " objects of type double are dynamically allocated\n"
<< "they take up " << vec.size() * sizeof(double) << " bytes of memory "
<< "starting at address " << std::addressof( vec.front() )
<< "\nthe standard allocator allocates this memory from the free store\n" ;
}
clang++ -std=c++11 -stdlib=libc++ -O2 -Wall -Wextra -pedantic-errors main.cpp -lsupc++ && ./a.out
object 'vec' takes up 24 bytes at address 0x7fffea8b4520
it has an automatic storage duration (typically placed on the runtime-stack)
the 1000 objects of type double are dynamically allocated
they take up 8000 bytes of memory starting at address 0x24b8010
the standard allocator allocates this memory from the free store