FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cxx11-test-initializer_list.cpp
Go to the documentation of this file.
1 #include <vector>
2 
3 class seq {
4 public:
5  seq(std::initializer_list<int> list);
6 
7  int length() const;
8 private:
9  std::vector<int> m_v;
10 };
11 
12 seq::seq(std::initializer_list<int> list)
13  : m_v(list)
14 {
15 }
16 
17 int seq::length() const
18 {
19  return m_v.size();
20 }
21 
22 int main(void)
23 {
24  seq a = {18, 20, 2, 0, 4, 7};
25 
26  return (a.length() == 6) ? 0 : 1;
27 }
int length() const
int main(void)
seq(std::initializer_list< int > list)