string::begin

iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;

#include <iostream>
#include <string>

using namespace std;
int main()
{
string s1("hello");
cout << s1 << endl;
string::iterator it = s1.end() - 1;
cout << *it << endl;
it = s1.begin();
cout << *it << endl;
return 0;
}

posted @ 2019-12-23 13:24  MoonXu  阅读(196)  评论(0编辑  收藏  举报