summaryrefslogtreecommitdiffstats
path: root/raul/Table.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-07-26 08:16:44 +0000
committerDavid Robillard <d@drobilla.net>2007-07-26 08:16:44 +0000
commitffe8ccde2157ef802b7876cef9489904c02bcece (patch)
treec02d6149a0cafa6542a86bbfd0cfab86e2906d0e /raul/Table.hpp
parentca1c84d3d3df15ed62588c77bbbae537a83c016f (diff)
downloadraul-ffe8ccde2157ef802b7876cef9489904c02bcece.tar.gz
raul-ffe8ccde2157ef802b7876cef9489904c02bcece.tar.bz2
raul-ffe8ccde2157ef802b7876cef9489904c02bcece.zip
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
Diffstat (limited to 'raul/Table.hpp')
-rw-r--r--raul/Table.hpp6
1 files changed, 4 insertions, 2 deletions
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<K, T>() {}
void clear() { _entries.clear(); }
+ bool empty() const { return _entries.empty(); }
struct const_iterator {
const_iterator(const Table<K,T>& t, size_t i) : _table(t), _index(i) {}
- inline const std::pair<const K, T>& operator*() const { return _table._entries[_index]; }
+ inline const std::pair<const K, T> operator*() const { return _table._entries[_index]; }
inline const std::pair<const K, T>* operator->() const { return (std::pair<const K, T>*)&_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<iterator,bool> insert(const std::pair<K, T>& entry);
+
void erase(const K& key);
void erase(iterator i);
void erase(iterator begin, iterator end);