From b7ad436ab6967a9d932c47ced5220cdbad4cd8d5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2007 19:16:52 +0000 Subject: Use PathTable for engine side objects. Re-implement renaming and destroying more cleanly (not to mention workingly). git-svn-id: http://svn.drobilla.net/lad/raul@638 a436a847-0d15-0410-975c-d299462d15a1 --- raul/Table.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'raul/Table.hpp') diff --git a/raul/Table.hpp b/raul/Table.hpp index 3342bdb..4ab449c 100644 --- a/raul/Table.hpp +++ b/raul/Table.hpp @@ -33,7 +33,8 @@ namespace Raul { template class Table { public: - Table() {} + Table() : _entries() {} + Table(size_t capacity) : _entries(capacity) {} void clear() { _entries.clear(); } bool empty() const { return _entries.empty(); } @@ -56,8 +57,8 @@ public: struct iterator { iterator(Table& t, size_t i) : _table(t), _index(i) {} - inline std::pair& operator*() const { return (std::pair&)_table._entries[_index]; } - inline std::pair* operator->() const { return (std::pair*)&_table._entries[_index]; } + inline std::pair& operator*() const { return (std::pair&)_table._entries[_index]; } + inline std::pair* operator->() const { return (std::pair*)&_table._entries[_index]; } inline iterator& operator++() { ++_index; return *this; } inline iterator& operator--() { --_index; return *this; } inline bool operator==(const iterator& i) const { return _index == i._index; } @@ -79,9 +80,9 @@ public: void erase(iterator start, iterator end); void erase_by_index(size_t start, size_t end); - std::vector > yank(iterator start, iterator end); + Table yank(iterator start, iterator end); - std::pair cram(const std::vector >& range); + std::pair cram(const Table& range); const_iterator find(const K& key) const; iterator find(const K& key); -- cgit v1.2.1