Link<T>::OK() const
{
#ifndef NDEBUG
- if (previous_) {
- assert(previous_->next_ == this);
+ if (previous_)
+ {
+ assert (previous_->next_ == this);
}
- if (next_) {
- assert(next_->previous_ == this);
+ if (next_)
+ {
+ assert (next_->previous_ == this);
}
#endif
}
template<class T>
inline
-Link<T>::Link( const T& thing ) :
- thing_( thing )
+Link<T>::Link (const T& thing) :
+ thing_(thing)
{
- previous_ = next_ = 0;
+ previous_ = next_ = 0;
}
template<class T>
inline
-Link<T>::Link( Link<T>* previous, Link<T>* next, const T& thing ) :
- thing_( thing )
+Link<T>::Link (Link<T>* previous, Link<T>* next, const T& thing) :
+ thing_(thing)
{
- previous_ = previous;
- next_ = next;
+ previous_ = previous;
+ next_ = next;
}
template<class T>
Link<T>*
Link<T>::next()
{
- return next_;
+ return next_;
}
template<class T>
Link<T>*
Link<T>::previous()
{
- return previous_;
+ return previous_;
}
template<class T>
inline
void
-Link<T>::add( const T& thing )
+Link<T>::add (const T& thing)
{
-
- Link<T>* l = new Link<T>( this, next_, thing );
- if ( next_ )
- next_->previous_ = l;
- next_ = l;
+
+ Link<T>* l = new Link<T>(this, next_, thing);
+ if (next_)
+ next_->previous_ = l;
+ next_ = l;
}
template<class T>
inline void
-Link<T>::insert( const T& thing )
+Link<T>::insert (const T& thing)
{
- // Link<T>* l = new Link<T>( next_, this, thing );
+ // Link<T>* l = new Link<T>(next_, this, thing);
// bugfix hwn 16/9/96
- Link<T>* l = new Link<T>( previous_, this, thing );
- if ( previous_ )
- previous_->next_ = l;
- previous_ = l;
+ Link<T>* l = new Link<T>(previous_, this, thing);
+ if (previous_)
+ previous_->next_ = l;
+ previous_ = l;
}
/*
- don't forget to adjust #l#'s top_ and bottom_.
- */
+ don't forget to adjust #l#'s top_ and bottom_.
+ */
template<class T>
inline void
-Link<T>::remove(List<T> &l)
+Link<T>::remove (List<T> &l)
{
- if ( previous_ )
- previous_->next_ = next_;
- else
- l.top_ = next_;
+ if (previous_)
+ previous_->next_ = next_;
+ else
+ l.top_ = next_;
- if ( next_ )
- next_->previous_ = previous_;
- else
- l.bottom_ = previous_;
+ if (next_)
+ next_->previous_ = previous_;
+ else
+ l.bottom_ = previous_;
}
template<class T>
T&
Link<T>::thing()
{
- return thing_;
+ return thing_;
}
#endif