Skip to content

Commit

Permalink
add dtor prints to emplace example.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaptGreg committed Jan 2, 2018
1 parent 8afe1fa commit 7d259ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions emplace.cpp
Expand Up @@ -32,10 +32,13 @@ struct President
std::cout << "I am being moved.\n";
}
President& operator=(const President& other) = default;
~President() { std::cout << "President destructor\n"; }
};

int main()
{
atexit([] {std::cout << "main over (atexit called).\n";});

std::vector<President> elections;
std::cout << "emplace_back:\n";
elections.emplace_back("Nelson Mandela", "South Africa", 1994);
Expand All @@ -53,4 +56,5 @@ int main()
std::cout << president.name << " was re-elected president of "
<< president.country << " in " << president.year << ".\n";
}
std::cout << "End of main.\n";
}

0 comments on commit 7d259ee

Please sign in to comment.