diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-07-30 05:26:59 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-07-30 05:26:59 +0000 |
| commit | 630b75aadac4ed6c5e71fb79cbca2ac435abbf83 (patch) | |
| tree | cbbac6f66f21f59570b43ae6da01e9bfe2dee7a8 /src/stable | |
| parent | bfd12b10e440d65d5b5156d2b21df184b24a2e98 (diff) | |
| download | libbu++-630b75aadac4ed6c5e71fb79cbca2ac435abbf83.tar.gz libbu++-630b75aadac4ed6c5e71fb79cbca2ac435abbf83.tar.bz2 libbu++-630b75aadac4ed6c5e71fb79cbca2ac435abbf83.tar.xz libbu++-630b75aadac4ed6c5e71fb79cbca2ac435abbf83.zip | |
Added helpers: Bu::List::eraseFirst and Bu::List::eraseLast. Pretty self
explanatory.
Diffstat (limited to '')
| -rw-r--r-- | src/stable/list.h | 24 |
1 files changed, 24 insertions, 0 deletions
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 | |||
| 869 | 869 | ||
| 870 | return *this; | 870 | return *this; |
| 871 | } | 871 | } |
| 872 | |||
| 873 | /** | ||
| 874 | * Erases the first item in the list, identical to pop, but better for | ||
| 875 | * lists that aren't built as stacks, since you know where it will be | ||
| 876 | * erasing from. | ||
| 877 | */ | ||
| 878 | MyType &eraseFirst() | ||
| 879 | { | ||
| 880 | _hardCopy(); | ||
| 881 | erase( begin() ); | ||
| 882 | |||
| 883 | return *this; | ||
| 884 | } | ||
| 885 | |||
| 886 | /** | ||
| 887 | * Erases the last item in the list. | ||
| 888 | */ | ||
| 889 | MyType &eraseLast() | ||
| 890 | { | ||
| 891 | _hardCopy(); | ||
| 892 | core->erase( core->pLast ); | ||
| 893 | |||
| 894 | return *this; | ||
| 895 | } | ||
| 872 | 896 | ||
| 873 | iterator find( const value &v ) | 897 | iterator find( const value &v ) |
| 874 | { | 898 | { |
