Skip to content

Instantly share code, notes, and snippets.

@milesrout
Created March 28, 2017 21:53
Show Gist options
  • Save milesrout/3bc652c96ad5c782db101e6af206b3aa to your computer and use it in GitHub Desktop.
Save milesrout/3bc652c96ad5c782db101e6af206b3aa to your computer and use it in GitHub Desktop.
#include <iostream>
#include <map>
using namespace std;
struct person { std::string first, last; };
int main() {
std::map<std::string, person> m;
if (auto [_, was_inserted] = m.emplace("43662121", person{"Miles", "Rout"}); was_inserted) {
std::cout << "Student 43662121 was added to the map";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment