aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-11 02:09:45 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-06-11 02:09:45 +0000
commit8d8da1b3e919fe05871046cecef6bcaf1da2e68b (patch)
tree45f8734ca873a7a8834e0227f8be0899a72b6523
parentf6cd0a0962416d3bab088d0448f8f86da1788729 (diff)
downloadpaludis-8d8da1b3e919fe05871046cecef6bcaf1da2e68b.tar.gz
paludis-8d8da1b3e919fe05871046cecef6bcaf1da2e68b.tar.xz
Add a push_back method for SequentialCollection, so that a std::back_insert_iterator can be used. Include a const_reference typedef in SequentialCollection, for various standard algorithms.
-rw-r--r--paludis/util/collection.hh15
1 files changed, 15 insertions, 0 deletions
diff --git a/paludis/util/collection.hh b/paludis/util/collection.hh
index e8d615f..764d3f6 100644
--- a/paludis/util/collection.hh
+++ b/paludis/util/collection.hh
@@ -54,6 +54,12 @@ namespace paludis
public:
/**
+ * Issue with g++ 3.4.6: const_reference isn't defined via our std::iterator
+ * inherit, but it is needed by many standard algorithms.
+ */
+ typedef const T_ & const_reference;
+
+ /**
* Constructor.
*/
SequentialCollection()
@@ -117,6 +123,15 @@ namespace paludis
}
/**
+ * Append an item.
+ */
+ void push_back(const T_ & v)
+ {
+ if (end() == find(v))
+ _items.push_back(v);
+ }
+
+ /**
* Are we empty?
*/
bool empty() const