From 630b75aadac4ed6c5e71fb79cbca2ac435abbf83 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 30 Jul 2012 05:26:59 +0000 Subject: Added helpers: Bu::List::eraseFirst and Bu::List::eraseLast. Pretty self explanatory. --- src/stable/list.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/stable') diff --git a/src/stable/list.h b/src/stable/list.h index 0afed96..4f9d4aa 100644 --- a/src/stable/list.h +++ b/src/stable/list.h @@ -869,6 +869,30 @@ namespace Bu return *this; } + + /** + * Erases the first item in the list, identical to pop, but better for + * lists that aren't built as stacks, since you know where it will be + * erasing from. + */ + MyType &eraseFirst() + { + _hardCopy(); + erase( begin() ); + + return *this; + } + + /** + * Erases the last item in the list. + */ + MyType &eraseLast() + { + _hardCopy(); + core->erase( core->pLast ); + + return *this; + } iterator find( const value &v ) { -- cgit v1.2.3