随笔分类 -  STL

摘要:1.获得子串 #include<string> string hi; hi.substr(0,5)//从下标为0开始,截取5个字符 2.翻转字符串 //string类型 #include<algorithm> string hi; reverse(hi.begin(),hi.end()); //字符 阅读全文
posted @ 2021-04-02 10:55 Macondo's 阅读(50) 评论(0) 推荐(0)
摘要:迭代器和逆向迭代器的相互转化: //迭代器转为逆向迭代器,用逆向迭代器的构造函数 deque<int>::iterator it; deque<int>::reverse_iterator its(it); //逆向迭代器转化为普通迭代器,使用逆向迭代器的base构造函数 deque<int>::r 阅读全文
posted @ 2021-03-29 20:16 Macondo's 阅读(61) 评论(0) 推荐(0)