[Aptitude-svn-commit] r3999 - in branches/aptitude-0.3/aptitude: . src/generic

Daniel Burrows dburrows at costa.debian.org
Tue Aug 30 19:59:23 UTC 2005


Author: dburrows
Date: Tue Aug 30 19:59:20 2005
New Revision: 3999

Modified:
   branches/aptitude-0.3/aptitude/ChangeLog
   branches/aptitude-0.3/aptitude/src/generic/util.h
Log:
Add some missing functor classes.

Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog	(original)
+++ branches/aptitude-0.3/aptitude/ChangeLog	Tue Aug 30 19:59:20 2005
@@ -1,5 +1,10 @@
 2005-08-30  Daniel Burrows  <dburrows at debian.org>
 
+	* src/generic/util.h:
+
+	  Add some missing functor classes that are in libstdc++ but
+	  aren't standard.
+
 	* src/generic/immset.h:
 
 	  Add a missing const qualifier.

Modified: branches/aptitude-0.3/aptitude/src/generic/util.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/util.h	(original)
+++ branches/aptitude-0.3/aptitude/src/generic/util.h	Tue Aug 30 19:59:20 2005
@@ -53,4 +53,34 @@
   }
 };
 
+/** A function object representing the identity operation. */
+template<typename T>
+struct identity
+{
+  T operator()(const T &t) const
+  {
+    return t;
+  }
+};
+
+/** A function object that extracts the first element from a pair. */
+template<typename T1, typename T2>
+struct select1st
+{
+  T1 operator()(const std::pair<T1, T2> &p) const
+  {
+    return p.first;
+  }
+};
+
+/** A function object that extracts the second element from a pair. */
+template<typename T1, typename T2>
+struct select2nd
+{
+  T2 operator()(const std::pair<T1, T2> &p) const
+  {
+    return p.second;
+  }
+};
+
 #endif



More information about the Aptitude-svn-commit mailing list