📅  最后修改于: 2022-03-11 14:44:50.896000             🧑  作者: Mango
#include
#include
#include
int main() {
std::unordered_set planets{
{"Venus"},
{"Earth"},
{"Mars"},
};
auto it = planets.find("Earth");
if (it != planets.end()) {
std::cout << *it << "\n";
} else {
std::cout << "No such planet.\n";
}
it = planets.find("PlanetX");
if (it != planets.end()) {
std::cout << *it << "\n";
} else {
std::cout << "No such planet.\n";
}
}