Program 1:
#include
#include
#include
int main(){
//compiles successfully
std::vect
std::queue
and std::stack
are not actually containers, they are so called container adaptors which uses a container (by default std::deque
). Therefore you can not initialize it as other containers.
Edit
For a container to be able to use an initializer list, it must have a constructor taking an std::initializer_list as argument. The container adaptors don't do that. If it's deliberate or an oversight of the standards committee is up to anyones interpretation.