Using C++11:
std::set<std::string> str = {"John", "Kelly", "Amanda", "Kim"};
Otherwise:
std::string tmp[] = {"John", "Kelly", "Amanda", "Kim"};
std::set<std::string> str(tmp, tmp + sizeof(tmp) / sizeof(tmp[0]));
std::set<std::string> str = {"John", "Kelly", "Amanda", "Kim"};
std::string tmp[] = {"John", "Kelly", "Amanda", "Kim"};
std::set<std::string> str(tmp, tmp + sizeof(tmp) / sizeof(tmp[0]));
No comments:
Post a Comment