Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • C++

Idiom #134 Create a new list

Declare and initialize a new list items, containing 3 elements a, b, c.

list items { a, b, c };

For most uses, you actually want vector<> rather than list<>.
#include <vector>
std::vector<T> items = {a, b, c};

For C++11.
a, b, c have type T.
(def items (list a b c))

New implementation...