const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept;
注:返回常量迭代器,不能修改

#include <iostream>
#include <string>

using namespace std;

int main()
{
string s1("hello");
string::const_iterator it;
it = s1.cbegin();
cout << *it++ << endl;
cout << *it << endl;
//*it = 'a';//wrong read_only
it = s1.cend() - 1;
cout << *it << endl;
//*it = 'a';//wrong read_only
return 0;
}

string::cbegin string::cend的更多相关文章

  1. [C#] string 与 String,大 S 与小 S 之间没有什么不可言说的秘密

    string 与 String,大 S 与小 S 之间没有什么不可言说的秘密 目录 小写 string 与大写 String 声明与初始化 string string 的不可变性 正则 string ...

  2. java.lang.String.getBytes(String charsetName)方法实例

    java.lang.String.getBytes(String charsetName) 方法编码将此String使用指定的字符集的字节序列,并将结果存储到一个新的字节数组. 声明 以下是java. ...

  3. Lua的string和string库总结

    Lua有7种数据类型,分别是nil.boolean.number.string.table.function.userdata.这里我总结一下Lua的string类型和string库,复习一下,以便加 ...

  4. C#,int转成string,string转成int

    转载:http://www.cnblogs.com/xshy3412/archive/2007/08/29/874362.html 1,int转成string用toString 或者Convert.t ...

  5. C#中对string与string[]的初步操作

    开篇之作,简单的对string与string[]进行初步操作,入门篇也,不多说,直接上代码. using System; using System.Collections.Generic; using ...

  6. Java提高篇——理解String 及 String.intern() 在实际中的应用

    1. 首先String不属于8种基本数据类型,String是一个对象.   因为对象的默认值是null,所以String的默认值也是null:但它又是一种特殊的对象,有其它对象没有的一些特性. 2. ...

  7. [C#]List<int>转string[],string[]转为string

    // List<int>转string[] public string[] ListInt2StringArray(List<int> input) { return Arra ...

  8. String和string的区别(C#)

    从位置讲: 1.String是.NET  Framework里面的String,小写的string是C#语言中的string 2.如果把using System;删掉,没有大写的String了,Sys ...

  9. String、String.valueOf、toString 它们三者的区别总结

    今天在使用这个的时候发现,他们三者好像在某些场所都是可以用的,但是不免会让人想到那既然它们三者这么的相似,那么总有些什么区别吧.我也在网上找了一些资料看.自己也看了API文档,就将他们三的区别总结一下 ...

随机推荐

  1. Fabric1.4 背书策略 .yam文件

    { identities: [ // 以下几项自动编号为[0,1,2] { role: { name: "member", mspId: "peerOrg1" ...

  2. 【FFMPEG】FFMPEG介绍

    FFmpeg是一套可以用来记录.转换数字音频.视频,并能将其转化为流的开源计算机程序.它包括了目前领先的音/视频编码库libavcodec. FFmpeg是在Linux下开发出来的,但它可以在包括Wi ...

  3. Spring A 标签链接使用

    1.示例 <a th:href="@{/edit/{id}(id=${user.id})}">修改</a> 以@开头前面的{id}是占位符,后面的(id=$ ...

  4. redis的事物操作

  5. There are no packages available

    { "bootstrapped": true, "channels": [ "https://raw.githubusercontent.com/Ja ...

  6. lua 模块与包(五)

    一.模块的介绍 模块类似于1个封装库,从Lua 5.1 开始,Lua加入了标准的模块管理机制,可以把一些公用的代码放在一个文件里,以API接口的形式在其他地方调用,用利于代码的重用和降低代码的耦合度. ...

  7. 【AtCoder】CODE FESTIVAL 2016 qual B

    CODE FESTIVAL 2016 qual B A - Signboard -- #include <bits/stdc++.h> #define fi first #define s ...

  8. Is It A Tree? POJ - 1308(并查集判树)

    Problem Description A tree is a well-known data structure that is either empty (null, void, nothing) ...

  9. 20190805-Python基础 第二章 列表和元组(2)列表

    1. list函数,用于将字符串转换为列表 2. 基本的列表操作 修改列表 - 给元素赋值,使用索引表示法给特定的元素赋值,如x[1] = 2 删除元素 - 使用del语句即可 name1 = ['a ...

  10. Django(一)安装启动

    Django下载/启动 1.下载安装 pip install django 或者 压缩文件下载地址:https://github.com/django/django/releases python s ...