Commit 01738d08 authored by Eugene Kosov's avatar Eugene Kosov

add debug assertion to ilist

parent c96be848
...@@ -26,8 +26,7 @@ template <class Tag= void> struct ilist_node ...@@ -26,8 +26,7 @@ template <class Tag= void> struct ilist_node
{ {
ilist_node() ilist_node()
#ifndef DBUG_OFF #ifndef DBUG_OFF
: : next(NULL), prev(NULL)
next(NULL), prev(NULL)
#endif #endif
{ {
} }
...@@ -70,11 +69,12 @@ template <class T, class Tag= void> class ilist ...@@ -70,11 +69,12 @@ template <class T, class Tag= void> class ilist
typedef T *pointer; typedef T *pointer;
typedef T &reference; typedef T &reference;
Iterator(ListNode *node) : node_(node) {} Iterator(ListNode *node) : node_(node) { assert(node_); }
Iterator &operator++() Iterator &operator++()
{ {
node_= node_->next; node_= node_->next;
assert(node_);
return *this; return *this;
} }
Iterator operator++(int) Iterator operator++(int)
...@@ -87,6 +87,7 @@ template <class T, class Tag= void> class ilist ...@@ -87,6 +87,7 @@ template <class T, class Tag= void> class ilist
Iterator &operator--() Iterator &operator--()
{ {
node_= node_->prev; node_= node_->prev;
assert(node_);
return *this; return *this;
} }
Iterator operator--(int) Iterator operator--(int)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment