libcsdbg  1.28
C++ exception (and generic) stack trace debug library
template<class T>
stack< T > & csdbg::stack< T >::foreach ( void(*)(u32, T *)  pfunc) const
virtual

Traverse the stack with a callback for each node.

Parameters
[in]pfuncthe callback
Returns
*this

Definition at line 349 of file stack.hpp.

References __D_ASSERT, likely, and unlikely.

350 {
351  __D_ASSERT(pfunc != NULL);
352  if ( unlikely(pfunc == NULL) )
353  return const_cast<stack<T>&> (*this);
354 
355  u32 i = 0;
356  for (node<T> *n = m_top; likely(n != NULL); n = n->m_link)
357  pfunc(i++, n->m_data);
358 
359  return const_cast<stack<T>&> (*this);
360 }
#define likely(expr)
Offer a hint (positive) to the pipeline branch predictor.
Definition: config.hpp:344
node< T > * m_top
Stack top.
Definition: stack.hpp:34
unsigned int u32
32-bit unsigned integer
Definition: config.hpp:102
#define unlikely(expr)
Offer a hint (negative) to the pipeline branch predictor.
Definition: config.hpp:349
#define __D_ASSERT(x)
Assertion macro.
Definition: config.hpp:268