[Lemon-commits] [lemon_svn] deba: r2048 - hugo/trunk/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:49:45 CET 2006
Author: deba
Date: Wed Jul 13 15:16:57 2005
New Revision: 2048
Modified:
hugo/trunk/lemon/graph_utils.h
Log:
Swap function for DescriptorMap
Modified: hugo/trunk/lemon/graph_utils.h
==============================================================================
--- hugo/trunk/lemon/graph_utils.h (original)
+++ hugo/trunk/lemon/graph_utils.h Wed Jul 13 15:16:57 2005
@@ -749,6 +749,18 @@
public:
+ /// \brief Swaps the position of the two items in the map.
+ ///
+ /// Swaps the position of the two items in the map.
+ void swap(const Item& p, const Item& q) {
+ int pi = Map::operator[](p);
+ int qi = Map::operator[](q);
+ Map::set(p, qi);
+ invMap[qi] = p;
+ Map::set(q, pi);
+ invMap[pi] = q;
+ }
+
/// \brief Gives back the \e descriptor of the item.
///
/// Gives back the mutable and unique \e descriptor of the map.
@@ -790,7 +802,7 @@
/// \brief Size of the map.
///
/// Returns the size of the map.
- unsigned size() const {
+ int size() const {
return inverted.invMap.size();
}
More information about the Lemon-commits
mailing list