首页 > 其他 > 详细

string::crbegin string::crend

时间:2019-12-23 18:28:29      阅读:115      评论:0      收藏:0      [点我收藏+]
const_reverse_iterator crbegin() const noexcept;
功能:crbegin是最后一个字符,crend第一个字符的前一个。迭代器向左移动是“+”,向右移动是“-”

#include <iostream>
#include <string>

using namespace std;

int main()
{
string s1("hello");
string::const_reverse_iterator it = s1.crbegin();
cout << *it << endl;//o
it = s1.crend() - 1;//h
cout << *it << endl;
return 0;
}

string::crbegin string::crend

原文:https://www.cnblogs.com/xpylovely/p/12085233.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!