Sack Library Documentation
sack::containers::BinaryTree::CreateBinaryTreeExtended Function
__cdecl TYPELIB_PROC PTREEROOT CreateBinaryTreeExtended(_32 flags, GenericCompare Compare, GenericDestroy Destroy DBG_PASS);

when adding a node if Compare is NULL the default method of a basic unsigned integer compare on the key value is done. if Compare is specified the specified key value of the orginal node (old) and of the new node (new) is added. Result of compare should be ( <0 (lesser)) ( 0 (equal)) ( >0 (greater))

int CPROC MyGenericCompare( PTRSZVAL oldnode,PTRSZVAL newnode )
       return 1;
   else if(oldnode<newnode)
       return -1;
   else return 0;
   return (oldnode>newnode)? 1
          :(oldnode<newnode)? -1
void CPROC MyGenericDestroy(POINTER user, PTRSZVAL key)
   // do something custom with your user data and or key value
PTREEROOT tree = CreateBinaryTreeExtended( 0 // BT_OPT_NODUPLICATES
                                         , MyGenericCompare
                                         , MyGenericDestroy
                                         DBG_SRC );
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
Copyright (c) 2000+. All rights reserved.
What do you think about this topic? Send feedback!