stdunordered_setstdstring元素数量
std::unordered_set是一个无序的集合,它不允许重复的元素。元素的数量可以使用size()方法来获取,例如:
std::unordered_setstd::string mySet; mySet.insert("apple"); mySet.insert("banana"); mySet.insert("orange");
int count = mySet.size(); 上述代码中,mySet中的元素数量为3,因为它包含了三个不同的字符串元素。
原文地址: https://www.cveoy.top/t/topic/is6c 著作权归作者所有。请勿转载和采集!