front
语法:
1 |
reference front(); |
front()函数返回一个引用,指向链表的第一个元素。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
源代码 /** * Returns a read/write reference to the data at the first * element of the %list. */ reference front() { return *begin(); } /** * Returns a read-only (constant) reference to the data at the first * element of the %list. */ const_reference front() const { return *begin(); } |
测试代码
测试结果
9 8 7 6 5 4 3 2 1 0
0