std::array::begin
iterator begin() noexcept;
const_iterator begin() const noexcept;
Returns an iterator pointing to the first element in the array container.
返回一个指向array容器第一个元素的iterator.
Notice that, unlike member array::front, which returns a reference to the first element, this function returns
a random access iterator pointing to it.
注意和array::front不同,front是返回一个指向第一个元素的引用,这个函数是返回一个指向第一个元素的随机访问迭代器。
In zero-sized arrays, this function returns the same as array::end, but the returned iterator should not be dereferenced.
如果array大小为0,该函数的返回值和end是一样的,但是他们都不应该被解除引用。
例子:
#include <iostream> #include <array> using namespace std; void end1(){ array<double,0> ad; auto ib=ad.begin(); cout<<"ad.begin()="<<*ib<<endl; }
运行结果:
Parameters
none
Return Value
An iterator to the beginning of the sequence.
返回一个指向第一个元素的迭代器。
If the array object is const-qualified, the function returns a const_iterator. Otherwise, it returns an iterator.
如果array对象是const属性,那么返回一个const_itertor,否则,返回一个普通的iterator.
Member types iterator and const_iterator are random access iterator types (pointing
to an element and to a const element, respectively).
iterator和const_iterator都是随机访问迭代器。
Example
|
|
Output:
myarray contains: 2 16 77 34 50
|
Complexity
Constant.
Iterator validity
No changes.
Data races
No contained elements are accessed by the call, but the iterator returned can be used to access or modify elements. Concurrently accessing or modifying different elements is safe.
容器的元素不会被访问,但是返回的迭代器可以被用来访问以及修改元素,并且这些操作都是安全的。
Exception safety
No-throw guarantee: this member function never throws exceptions.
该成员方法不会抛出异常。
The copy construction or assignment of the returned iterator is also guaranteed to never throw.
通过复制构造器以及赋值构造获得的该iterator也保证不会抛出异常。
——————————————————————————————————————————————————————————————————
//翻译的不好的地方请多多指导,可以在下面留言或者点击左上方邮件地址给我发邮件,指出我的错误以及不足,以便我修改,更好的分享给大家,谢谢。
转载请注明出处:http://blog.csdn.net/qq844352155
author:天下无双
2014-8-26
于GDUT
——————————————————————————————————————————————————————————————————