您当前的位置: 首页 >  c++

C++ std::set 取第一个元素

发布时间:2021-10-11 16:06:50 ,浏览量:7

#include#includeusing 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::setmyset = { 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;
}

关注
打赏
1688896170
查看更多评论

暂无认证

  • 7浏览

    0关注

    115984博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录

0.1189s