Sack Library Documentation
ContentsIndexReferenceHome
PreviousUpNext
sack::containers::list::AddLink Macro
C++
#define AddLink(p,v) ( AddLinkEx( (p),((POINTER)(v)) DBG_SRC ) )

Adds a pointer to a user object to a list.

   
// the list can be initialized to NULL,
// it does not have to be assigned the result of a CreateList().
// this allows the list to only be allocated if it is used.
PLIST list = NULL;
   
AddLink( &list, (POINTER)user_pointer );
   
   
{
    POINTER p; // this should be USER_DATA_TYPE *p;
    INDEX idx; // just a generic counter.
    LIST_FORALL( list, idx, POINTER, p )
    {
        // for each item in the list, p will be not null.
        if( p->something == some_other_thing )
            break;
    }
    // p will be NULL if the list is empty
    // p will be NULL if the LIST_FORALL loop completes to termination.
    // p will be not NULL if the LIST_FORALL loop executed a 'break;'
}
Created with a commercial version of Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at support@toolsfactory.com.
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!