lemon/bits/alteration_notifier.h
changeset 231 9ce7a01a95c7
parent 220 a5d8c039f218
child 236 da953e387d31
equal deleted inserted replaced
4:7c504d14206a 5:f3da994f92fb
   407       while (it != _observers.end()) {
   407       while (it != _observers.end()) {
   408         try {
   408         try {
   409           (*it)->erase(item);
   409           (*it)->erase(item);
   410           ++it;
   410           ++it;
   411         } catch (const ImmediateDetach&) {
   411         } catch (const ImmediateDetach&) {
   412           it = _observers.erase(it);
       
   413           (*it)->_index = _observers.end();
   412           (*it)->_index = _observers.end();
   414           (*it)->_notifier = 0;
   413           (*it)->_notifier = 0;
       
   414           it = _observers.erase(it);
   415         }
   415         }
   416       }
   416       }
   417     }
   417     }
   418 
   418 
   419     /// \brief Notifies all the registed observers about more item erased
   419     /// \brief Notifies all the registed observers about more item erased
   427       while (it != _observers.end()) {
   427       while (it != _observers.end()) {
   428         try {
   428         try {
   429           (*it)->erase(items);
   429           (*it)->erase(items);
   430           ++it;
   430           ++it;
   431         } catch (const ImmediateDetach&) {
   431         } catch (const ImmediateDetach&) {
   432           it = _observers.erase(it);
       
   433           (*it)->_index = _observers.end();
   432           (*it)->_index = _observers.end();
   434           (*it)->_notifier = 0;
   433           (*it)->_notifier = 0;
       
   434           it = _observers.erase(it);
   435         }
   435         }
   436       }
   436       }
   437     }
   437     }
   438 
   438 
   439     /// \brief Notifies all the registed observers about the container is
   439     /// \brief Notifies all the registed observers about the container is
   466       while (it != _observers.end()) {
   466       while (it != _observers.end()) {
   467         try {
   467         try {
   468           (*it)->clear();
   468           (*it)->clear();
   469           ++it;
   469           ++it;
   470         } catch (const ImmediateDetach&) {
   470         } catch (const ImmediateDetach&) {
   471           it = _observers.erase(it);
       
   472           (*it)->_index = _observers.end();
   471           (*it)->_index = _observers.end();
   473           (*it)->_notifier = 0;
   472           (*it)->_notifier = 0;
       
   473           it = _observers.erase(it);
   474         }
   474         }
   475       }
   475       }
   476     }
   476     }
   477   };
   477   };
   478 
   478