aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-03 16:46:28 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-03 16:46:28 +0000
commitbb4d4c02e28d2bd245a4e556a68ee0c213e19433 (patch)
tree590bc66107a89fedbeb839869c3d7c083bbacce6
parent0ba2096aba6461243798f27020ab2c8b7f5af689 (diff)
downloadpaludis-bb4d4c02e28d2bd245a4e556a68ee0c213e19433.tar.gz
paludis-bb4d4c02e28d2bd245a4e556a68ee0c213e19433.tar.xz
Add SelectFirst convenience class. No SelectSecond because I don't need it and I'm lazy.
-rw-r--r--paludis/transform_insert_iterator.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/paludis/transform_insert_iterator.hh b/paludis/transform_insert_iterator.hh
index 3d8cd2e..5d8dfb4 100644
--- a/paludis/transform_insert_iterator.hh
+++ b/paludis/transform_insert_iterator.hh
@@ -123,6 +123,20 @@ namespace paludis
{
return TransformInsertIterator<Iter_, Trans_>(i, t);
}
+
+ /**
+ * Convenience class: select the first item of a pair.
+ */
+ template <typename A_, typename B_>
+ struct SelectFirst :
+ std::unary_function<A_, std::pair<A_, B_> >
+ {
+ A_ operator() (const std::pair<A_, B_> & p) const
+ {
+ return p.first;
+ }
+ };
+
}
#endif