From ffe8ccde2157ef802b7876cef9489904c02bcece Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2007 08:16:44 +0000 Subject: Add Table unit test. Match std::map interface for empty and insert (more powerful insert interface). git-svn-id: http://svn.drobilla.net/lad/raul@631 a436a847-0d15-0410-975c-d299462d15a1 --- raul/Table.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'raul/Table.hpp') diff --git a/raul/Table.hpp b/raul/Table.hpp index 524d11c..db5216f 100644 --- a/raul/Table.hpp +++ b/raul/Table.hpp @@ -36,10 +36,11 @@ public: Table() {} void clear() { _entries.clear(); } + bool empty() const { return _entries.empty(); } struct const_iterator { const_iterator(const Table& t, size_t i) : _table(t), _index(i) {} - inline const std::pair& operator*() const { return _table._entries[_index]; } + inline const std::pair operator*() const { return _table._entries[_index]; } inline const std::pair* operator->() const { return (std::pair*)&_table._entries[_index]; } inline const_iterator& operator++() { ++_index; return *this; } inline const_iterator& operator--() { --_index; return *this; } @@ -70,7 +71,8 @@ public: inline size_t size() const { return _entries.size(); } - void insert(const K& key, const T& value); + std::pair insert(const std::pair& entry); + void erase(const K& key); void erase(iterator i); void erase(iterator begin, iterator end); -- cgit v1.2.1