umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- File List
- File Members

cxx11-initializer-lists.h
Go to the documentation of this file.
1// https://en.wikipedia.org/wiki/C%2B%2B11#Initializer_lists
2
3// #1
4 class SequenceClass {
5 public:
6 SequenceClass(std::initializer_list<int> list);
7};
8
9// #2
10 SequenceClass some_var = {1, 4, 5, 6};
11
12// #3
13 void function_name(std::initializer_list<float> list);
14
15 function_name({1.0f, -3.45f, -0.4f});
16
17
18// #4
19std::vector<std::string> v = { "xyzzy", "plugh", "abracadabra" };
20std::vector<std::string> v({ "xyzzy", "plugh", "abracadabra" });
21std::vector<std::string> v{ "xyzzy", "plugh", "abracadabra" }; // see "Uniform initialization" below
SequenceClass
Definition cxx11-initializer-lists.h:4
SequenceClass::SequenceClass
SequenceClass(std::initializer_list< int > list)
function_name
void function_name(std::initializer_list< float > list)
v
std::vector< std::string > v
Definition cxx11-initializer-lists.h:19
some_var
SequenceClass some_var
Definition cxx11-initializer-lists.h:10