#include <iostream> #include <list> int main() { std::list<int> mylist; mylist.assign({10, 20, 30, 40}); for (int val : mylist) { std::cout << val << " "; } return 0; }