#include <iostream>
#include <set>
using namespace std;
int main()
{
// cbegin/cend(c++11): Returns a const_iterator pointing to the first element in the container/
// Returns a const_iterator pointing to the past-the-end element in the container
std::set<int> myset = { 50, 20, 60, 10, 25 };
std::cout << "myset contains:";
for (auto it = myset.cbegin(); it != myset.cend(); ++it)
std::cout << ' ' << *it;
std::cout << '\n';
system("pause");
return 0;
}
C++ std::set 取第一个元素
原创
©著作权归作者所有:来自51CTO博客作者软件工程小施同学的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章