1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
// set::emplace
#include <iostream>
#include <set>
#include <string>
int main ()
{
std::set<std::string> myset;
myset.emplace("foo");
myset.emplace("bar");
auto ret = myset.emplace("foo");
if (!ret.second) std::cout << "foo already exists in myset\n";
return 0;
}
|