front() 和 begin() 的区别 [英] The difference between front() and begin()

查看:102
本文介绍了front() 和 begin() 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出现在许多 STL 容器中的 front()begin() 函数有什么区别?

What is the difference between the front() and begin() functions that appears in many STL containers?

推荐答案

begin() 返回一个迭代器,可用于遍历集合,而 front() 只返回对集合第一个元素的引用.

begin() returns an iterator that can be used to iterate through the collection, while front() just returns a reference to the first element of the collection.

这篇关于front() 和 begin() 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆