Bug fix in SmartEdgeSet
authordeba
Mon, 04 Sep 2006 12:27:03 +0000
changeset 21938057a4245685
parent 2192 d6e4efb477d8
child 2194 eaf16c8f6fef
Bug fix in SmartEdgeSet

+ validity check function
lemon/edge_set.h
     1.1 --- a/lemon/edge_set.h	Mon Sep 04 12:15:20 2006 +0000
     1.2 +++ b/lemon/edge_set.h	Mon Sep 04 12:27:03 2006 +0000
     1.3 @@ -584,15 +584,6 @@
     1.4      
     1.5      typedef _Graph Graph;
     1.6  
     1.7 -    class UnsupportedOperation : public LogicError {
     1.8 -    public:
     1.9 -      virtual const char* what() const throw() {
    1.10 -        return "lemon::SmartEdgeSet::UnsupportedOperation";
    1.11 -      }
    1.12 -    };
    1.13 -    
    1.14 -
    1.15 -
    1.16    protected:
    1.17  
    1.18      typedef typename Parent::NodesImplBase NodesImplBase;
    1.19 @@ -618,6 +609,10 @@
    1.20  
    1.21        virtual ~NodesImpl() {}
    1.22        
    1.23 +      bool attached() const {
    1.24 +        return Parent::attached();
    1.25 +      }
    1.26 +
    1.27      protected:
    1.28  
    1.29        virtual void erase(const Node& node) {
    1.30 @@ -626,6 +621,7 @@
    1.31            Parent::erase(node);
    1.32          } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
    1.33            Parent::clear();
    1.34 +          throw;
    1.35          }
    1.36        }
    1.37        virtual void erase(const std::vector<Node>& nodes) {
    1.38 @@ -636,6 +632,7 @@
    1.39            Parent::erase(nodes);
    1.40          } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) {
    1.41            Parent::clear();
    1.42 +          throw;
    1.43          }
    1.44        }
    1.45        virtual void clear() {
    1.46 @@ -657,6 +654,10 @@
    1.47      SmartEdgeSet(const Graph& graph) : nodes(graph, *this) {
    1.48        Parent::initalize(graph, nodes);
    1.49      }
    1.50 +
    1.51 +    bool valid() const {
    1.52 +      return nodes.attached();
    1.53 +    }
    1.54      
    1.55    };
    1.56  
    1.57 @@ -712,6 +713,10 @@
    1.58  	: Parent(graph), _edgeset(edgeset) {}
    1.59  
    1.60        virtual ~NodesImpl() {}
    1.61 +
    1.62 +      bool attached() const {
    1.63 +        return Parent::attached();
    1.64 +      }
    1.65        
    1.66      protected:
    1.67  
    1.68 @@ -754,6 +759,10 @@
    1.69      SmartUEdgeSet(const Graph& graph) : nodes(graph, *this) {
    1.70        Parent::initalize(graph, nodes);
    1.71      }
    1.72 +
    1.73 +    bool valid() const {
    1.74 +      return nodes.attached();
    1.75 +    }
    1.76      
    1.77    };
    1.78