begin
语法:
1 |
iterator begin(); |
begin()函数返回一个迭代器,指向list的第一个元素。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
源代码 /** * Returns a read/write iterator that points to the first element in the * %list. Iteration is done in ordinary element order. */ iterator begin() { return this->_M_impl._M_node._M_next; } /** * Returns a read-only (constant) iterator that points to the * first element in the %list. Iteration is done in ordinary * element order. */ const_iterator begin() const { return this->_M_impl._M_node._M_next; } |
测试代码
测试结果
J I H G F E D C B A