clear
语法:
1 |
void clear(); |
clear()函数删除list的所有元素。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
源代码 /** * Erases all the elements. Note that this function only erases * the elements, and that if the elements themselves are * pointers, the pointed-to memory is not touched in any way. * Managing the pointer is the user's responsibilty. */ void clear() { _Base::_M_clear(); _Base::_M_init(); } |
测试代码
测试结果
J I H G F E D C B A
0