[Aptitude-svn-commit] r3991 - in branches/aptitude-0.3/aptitude: .
src/generic
Daniel Burrows
dburrows at costa.debian.org
Tue Aug 30 16:23:08 UTC 2005
Author: dburrows
Date: Tue Aug 30 16:23:04 2005
New Revision: 3991
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/src/generic/immset.h
Log:
Expose key_compare as a toplevel class.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Aug 30 16:23:04 2005
@@ -1,3 +1,9 @@
+2005-08-30 Daniel Burrows <dburrows at debian.org>
+
+ * src/generic/immset.h:
+
+ Expose key_compare at the toplevel.
+
2005-08-29 Daniel Burrows <dburrows at debian.org>
* src/generic/setset.h, tests/test_setset.cc:
Modified: branches/aptitude-0.3/aptitude/src/generic/immset.h
==============================================================================
--- branches/aptitude-0.3/aptitude/src/generic/immset.h (original)
+++ branches/aptitude-0.3/aptitude/src/generic/immset.h Tue Aug 30 16:23:04 2005
@@ -683,28 +683,31 @@
return i1 == s1.end() && i2 == s2.end();
}
+ /** Auxillary class for map; used to order the contents of the map.
+ */
+ template<typename Key, typename Val, typename Compare>
+ struct key_compare
+ {
+ Compare real_cmp;
+ public:
+ key_compare(const Compare &_real_cmp)
+ :real_cmp(_real_cmp)
+ {
+ }
+
+ bool operator()(const std::pair<Key, Val> &p1,
+ const std::pair<Key, Val> &p2) const
+ {
+ return real_cmp(p1.first, p2.first);
+ }
+ };
template<typename Key, typename Val, typename Compare = std::less<Key> >
class map
{
public:
- struct key_compare
- {
- Compare real_cmp;
- public:
- key_compare(const Compare &_real_cmp)
- :real_cmp(_real_cmp)
- {
- }
-
- bool operator()(const std::pair<Key, Val> &p1,
- const std::pair<Key, Val> &p2) const
- {
- return real_cmp(p1.first, p2.first);
- }
- };
typedef std::pair<Key, Val> binding_type;
- typedef set<binding_type, key_compare> mapping_type;
+ typedef set<binding_type, key_compare<Key, Val, Compare> > mapping_type;
typedef typename mapping_type::const_iterator const_iterator;
typedef typename mapping_type::size_type size_type;
typedef typename mapping_type::node node;
@@ -740,7 +743,7 @@
/** Construct an empty map */
map(const Compare &value_compare = Compare())
- :contents(mapping_type(key_compare(value_compare)))
+ :contents(mapping_type(key_compare<Key, Val, Compare>(value_compare)))
{
}
More information about the Aptitude-svn-commit
mailing list