equal
deleted
inserted
replaced
747 Map::clear(); |
747 Map::clear(); |
748 } |
748 } |
749 |
749 |
750 public: |
750 public: |
751 |
751 |
|
752 /// \brief Swaps the position of the two items in the map. |
|
753 /// |
|
754 /// Swaps the position of the two items in the map. |
|
755 void swap(const Item& p, const Item& q) { |
|
756 int pi = Map::operator[](p); |
|
757 int qi = Map::operator[](q); |
|
758 Map::set(p, qi); |
|
759 invMap[qi] = p; |
|
760 Map::set(q, pi); |
|
761 invMap[pi] = q; |
|
762 } |
|
763 |
752 /// \brief Gives back the \e descriptor of the item. |
764 /// \brief Gives back the \e descriptor of the item. |
753 /// |
765 /// |
754 /// Gives back the mutable and unique \e descriptor of the map. |
766 /// Gives back the mutable and unique \e descriptor of the map. |
755 int operator[](const Item& item) const { |
767 int operator[](const Item& item) const { |
756 return Map::operator[](item); |
768 return Map::operator[](item); |
788 } |
800 } |
789 |
801 |
790 /// \brief Size of the map. |
802 /// \brief Size of the map. |
791 /// |
803 /// |
792 /// Returns the size of the map. |
804 /// Returns the size of the map. |
793 unsigned size() const { |
805 int size() const { |
794 return inverted.invMap.size(); |
806 return inverted.invMap.size(); |
795 } |
807 } |
796 |
808 |
797 private: |
809 private: |
798 const DescriptorMap& inverted; |
810 const DescriptorMap& inverted; |