vector cbegin

C ++ vector :: cbegin()函数 (C++ vector::cbegin() function)

vector::cbegin() is a library function of "vector" header, it is used to get the const iterator pointing to the first element of the vector.

vector :: cbegin()“ vector”头文件的库函数,用于获取指向向量第一个元素的const迭代器。

It returns a const_iterator which is an iterator point to the constant content(vector), the const_itertator can be increased or decreased just like an iterator but it cannot be used to update/modify the vector content it points to.

它返回一个const_iterator ,它是指向常量content(vector)的迭代器, const_itertator可以像迭代器一样增加或减少,但不能用于更新/修改其指向的向量内容。

Note: To use vector, include <vector> header.

注意:要使用向量,请包含<vector>标头。

Syntax of vector::cbegin() function

vector :: cbegin()函数的语法

    vector::cbegin();

Parameter(s): none – It accepts nothing.

参数: 无 –不接受任何内容。

Return value: const_iterator – It returns a constant iterator pointing to the first element of the vector.

返回值: const_iterator –它返回一个常量迭代器,指向向量的第一个元素。

Example:

例:

    Input:
vector<int> vector1{ 1, 2, 3, 4, 5 };
Function call:
vector<int>::const_iterator cit;
cit = vector1.cbegin();
cout<

C++ program to demonstrate example of vector::cbegin() function

Output
first element is: 10
Reference: C++ vector::cbegin()

TOP Interview Coding Problems/Challenges

  • Run-length encoding (find/print frequency of letters in a string)

  • Sort an array of 0's, 1's and 2's in linear time complexity

  • Checking Anagrams (check whether two string is anagrams or not)

  • Relative sorting algorithm

  • Finding subarray with given sum

  • Find the level in a binary tree with given sum K

  • Check whether a Binary Tree is BST (Binary Search Tree) or not

  • 1[0]1 Pattern Count

  • Capitalize first and last letter of each word in a line

  • Print vertical sum of a binary tree

  • Print Boundary Sum of a Binary Tree

  • Reverse a single linked list

  • Greedy Strategy to solve major algorithm problems

  • Job sequencing problem

  • Root to leaf Path Sum

  • Exit Point in a Matrix

  • Find length of loop in a linked list

  • Toppers of Class

  • Print All Nodes that don't have Sibling

  • Transform to Sum Tree

  • Shortest Source to Destination Path



Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.


Please enable JavaScript to view the comments powered by Disqus.

翻译自: https://www.includehelp.com/stl/vector-cbegin-function-with-example.aspx

vector cbegin

vector cbegin_vector :: cbegin()函数以及C ++ STL中的示例相关推荐

  1. stl中copy()函数_std :: copy_if()函数以及C ++ STL中的示例

    stl中copy()函数 C ++ STL std :: copy_if()函数 (C++ STL std::copy_if() function) copy_if() function is a l ...

  2. stl中copy()函数_std :: rotate_copy()函数以及C ++ STL中的示例

    stl中copy()函数 C ++ STL std :: rotate_copy()函数 (C++ STL std::rotate_copy() function) rotate_copy() fun ...

  3. stl中copy()函数_std :: copy()函数以及C ++ STL中的示例

    stl中copy()函数 C ++ STL std :: copy()函数 (C++ STL std::copy() function) copy() function is a library fu ...

  4. stl vector 函数_vector :: front()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: front()函数 (C++ vector::front() function) vector::front() is a library f ...

  5. stl vector 函数_vector :: at()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: at()函数 (C++ vector::at() function) vector::at() is a library function o ...

  6. stl vector 函数_vector :: crend()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: crend()函数 (C++ vector::crend() function) vector::crend() is a library f ...

  7. stl vector 函数_vector :: pop_back()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: pop_back()函数 (C++ vector::pop_back() function) vector::pop_back() is a ...

  8. stl vector 函数_vector :: back()函数以及C ++ STL中的示例

    stl vector 函数 C ++ vector :: back()函数 (C++ vector::back() function) vector::back() is a library func ...

  9. c++stl和std_std :: replace()函数以及C ++ STL中的示例

    c++stl和std C ++ STL std :: replace()函数 (C++ STL std::replace() function) replace() function is a lib ...

最新文章

  1. centos php 开启libgdgd_CentOS6.6下yum安装PHP的gd库失败?-问答-阿里云开发者社区-阿里云...
  2. dedian系统云服务器,云服务器选择Ubuntu还是Debian镜像系统?根据熟悉度选择
  3. 易语言自定义数据类型转c,一步一步跟我学易语言之自定义数据类型
  4. jupyter 服务器 显示不完全,Jupyter中显示DataFrame的行显示不完全
  5. JSK-18 跳跃游戏【基础】
  6. 雅黑科技php探针,雅黑PHP探针参数详解
  7. Java语言实现矩阵卷积运算
  8. 可编辑ppt地图分布图怎么做?
  9. web技术基础---网站设计说明书
  10. 苹果测试充电速度软件,数据传输以及充电速度测试
  11. 尚硅谷docker基础篇 2018版
  12. IGMP基础原理与实验
  13. 解决fullpage尾屏半屏问题
  14. centos7软件仓库资源的配置目录
  15. javascript基础-抢购器与双色球模拟摇奖器
  16. 「大哉数学之为用」优选法——梯级水库灌溉的优化设计
  17. 探寻虹膜识别背后的身份密码 | 硬创公开课
  18. 人生-《亲爱的安德烈》
  19. 华为笔记本机械盘卡死_华为笔记本死机了动不了怎么办
  20. [移动端]移动端设备属性

热门文章

  1. java 程序找错_java代码找错
  2. 背景se_盘点那些RPG手游中主角的背景故事,越悲情越强大
  3. date转timestamp格式_技术分享 | MySQL:timestamp 时区转换导致 CPU %sy 高的问题
  4. 龙神契约为什么显示服务器错误,龙神契约连服BOSS玩法介绍
  5. Shell脚本——内置命令
  6. nginx 非80、443端口跳转到80、443
  7. “云”上存储初显规模 如何架构是关键
  8. Java之类的构造器(反射)
  9. django 1.8 官方文档翻译:2-1-1 模型语法
  10. 【Microsoft Azure学习之旅】测试消息队列(Service Bus Queue)是否会丢消息