diff options
author | Max Horn | 2009-04-27 14:23:20 +0000 |
---|---|---|
committer | Max Horn | 2009-04-27 14:23:20 +0000 |
commit | e579f91b5c1b0949954037acf5bb4b364bfeb2b5 (patch) | |
tree | 3665306d61515c640885ce0bbec9b4d9c3a82d7d /common/list.h | |
parent | 6322478508e4a2a412efdb819b38d54c067cbbb6 (diff) | |
download | scummvm-rg350-e579f91b5c1b0949954037acf5bb4b364bfeb2b5.tar.gz scummvm-rg350-e579f91b5c1b0949954037acf5bb4b364bfeb2b5.tar.bz2 scummvm-rg350-e579f91b5c1b0949954037acf5bb4b364bfeb2b5.zip |
COMMON: Made sure Common::List and Common::array each have all front/back/push_back/push_front, as have their STL counterparts
svn-id: r40163
Diffstat (limited to 'common/list.h')
-rw-r--r-- | common/list.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/common/list.h b/common/list.h index 1685843e8e..d4252db8bb 100644 --- a/common/list.h +++ b/common/list.h @@ -63,14 +63,6 @@ public: clear(); } - void push_front(const t_T &element) { - insert(begin(), element); - } - - void push_back(const t_T &element) { - insert(end(), element); - } - void insert(iterator pos, const t_T &element) { ListInternal::NodeBase *newNode = new Node(element); @@ -127,9 +119,24 @@ public: ++i; } + void push_front(const t_T &element) { + // TODO: Bypass iterators here for improved efficency + insert(begin(), element); + } + + void push_back(const t_T &element) { + // TODO: Bypass iterators here for improved efficency + insert(end(), element); + } + void pop_front() { - iterator i = begin(); - i = erase(i); + // TODO: Bypass iterators here for improved efficency + erase(begin()); + } + + void pop_back() { + // TODO: Bypass iterators here for improved efficency + erase(reverse_begin()); } t_T &front() { @@ -148,7 +155,6 @@ public: return static_cast<Node *>(_anchor._prev)->_data; } - List<t_T> &operator=(const List<t_T> &list) { if (this != &list) { iterator i; |