本文整理汇总了C++中ListElement::prev方法的典型用法代码示例。如果您正苦于以下问题:C++ ListElement::prev方法的具体用法?C++ ListElement::prev怎么用?C++ ListElement::prev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListElement
的用法示例。
在下文中一共展示了ListElement::prev方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ListElement *List::erase( ListElement *position )
{
ListElement *ret = position->next();
if( position == m_head )
{
// could be 0 if m_head == m_tail
m_head = ret;
if ( ret != 0 )
{
ret->prev(0);
}
else
m_tail = 0;
}
else if ( position == m_tail )
{
// here, ret is 0 for sure.
m_tail = position->prev();
m_tail->next(0);
}
else {
// normal case
position->prev()->next( ret );
ret->prev( position->prev() );
}
if( m_deletor != 0 )
m_deletor( (void *) position->data() );
m_size--;
memFree( position );
return ret;
}
示例2: pushBack
void List::pushBack( const void *data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->data( data );
if ( m_head == 0 )
{
m_head = m_tail = element;
element->prev(0);
}
else {
element->prev( m_tail );
m_tail->next( element );
m_tail = element;
}
m_size++;
element->next( 0 );
}
示例3: insertBefore
void List::insertBefore( ListElement *position, const void *data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->data( data );
element->next( position );
element->prev( position->prev() );
if( position->prev() != 0 )
{
position->prev()->next( element );
}
position->prev( element );
m_size++;
if ( position == m_head )
m_head = element;
}
示例4: pushFront
void List::pushFront( uint32 data )
{
ListElement *element = (ListElement *) memAlloc( sizeof( ListElement ) );
element->iData( data );
if ( m_head == 0 )
{
m_head = m_tail = element;
element->next(0);
}
else {
element->next( m_head );
m_head->prev( element );
m_head = element;
}
m_size++;
element->prev( 0 );
}