From cfdb2a34a012f56a3ebfaf01094878a059fd1a18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 26 Nov 2014 15:03:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90clear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/List.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TinySTL/List.h b/TinySTL/List.h index 27d8ca9..4f1a4c1 100644 --- a/TinySTL/List.h +++ b/TinySTL/List.h @@ -133,7 +133,7 @@ namespace TinySTL{ iterator erase(iterator position); iterator erase(iterator first, iterator last); //void swap(List& x); - //void clear(); + void clear(); //void splice(iterator position, list& x); //void splice(iterator position, list& x, iterator i); //void splice(iterator position, list& x, iterator first, iterator last); @@ -246,6 +246,10 @@ namespace TinySTL{ } return res; } + template + void List::clear(){ + erase(begin(), end()); + } } #endif \ No newline at end of file