Ryg*_*guy 17 c++ stl
许多STL容器中出现的函数front()和begin()函数有什么区别?
front()
begin()
Joa*_*son 23
begin()返回一个迭代器,可用于迭代集合,同时front()只返回对集合的第一个元素的引用.
Mar*_*som 5
front()返回对第一个元素的引用,begin()并返回它的迭代器。
请注意,您不应该调用front空容器,但begin只要您不取消引用begin返回的迭代器,就可以调用。
front
begin
归档时间:
14 年 前
查看次数:
12110 次
最近记录:
8 年,3 月 前