diff options
| author | Eugene Sandulenko | 2004-03-15 02:45:40 +0000 |
|---|---|---|
| committer | Eugene Sandulenko | 2004-03-15 02:45:40 +0000 |
| commit | 759c05f936ab9a0317d28343a799d7c6857c3e27 (patch) | |
| tree | 6f44f3434e0a7a8d38671cd43b6e0713837c62a5 | |
| parent | deb96003a2e02efc1f394ebf8ddc772f5e37ddd3 (diff) | |
| download | scummvm-rg350-759c05f936ab9a0317d28343a799d7c6857c3e27.tar.gz scummvm-rg350-759c05f936ab9a0317d28343a799d7c6857c3e27.tar.bz2 scummvm-rg350-759c05f936ab9a0317d28343a799d7c6857c3e27.zip | |
Added remove_at method
svn-id: r13297
| -rw-r--r-- | common/list.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/list.h b/common/list.h index b4fea866ff..fd09ea0d9f 100644 --- a/common/list.h +++ b/common/list.h @@ -78,6 +78,16 @@ public: _size++; } + T& remove_at(int idx) { + T& tmp; + + assert(idx >= 0 && idx < _size); + tmp = _data[idx]; + for (int i = idx; i < _size - 1; i++) + _data[i] = _data[i+1]; + _size--; + return tmp; + } // TODO: insert, remove, ... |
