test_cpp.cxx
Go to the documentation of this file.
1 // test various C++ constructs, particularly wacky new ones.
2 
3 #include <string>
4 #include <iostream>
5 #include <vector>
6 
7 struct Person {
9  int id;
10 };
11 
12 void fill_people(std::vector<Person>& people)
13 {
14  Person guy{"Joe", 1}, gal{"Jane", 2}; // fancy initializing
15  people.push_back(std::move(guy));
16  people.push_back(std::move(gal));
17 }
18 
19 int main()
20 {
21  std::vector<Person> people;
22  fill_people(people);
23 
24  for (auto peep : people) {
25  std::cout << " #" << peep.id << ": " << peep.name << std::endl;
26  }
27 }
std::string string
Definition: nybbler.cc:12
def move(depos, offset)
Definition: depos.py:107
int main()
Definition: test_cpp.cxx:19
int id
Definition: test_cpp.cxx:9
std::string name
Definition: test_cpp.cxx:8
void fill_people(std::vector< Person > &people)
Definition: test_cpp.cxx:12
QTextStream & endl(QTextStream &s)