list.h

来自「关于tsp问题的基于windows环境下的mpi实现源代码。」· C头文件 代码 · 共 52 行

H
52
字号
/* list.h */

#ifndef _LIST_H
#define _LIST_H

typedef enum { FALSE_, TRUE_ } bool2;

//enum { FALSE_, TRUE_ } bool;

/* The following class defines a "list element" -- which is
 * used to keep track of one item on a list.  It is equivalent to a
 * Internal data structures kept public so that List operations can
 * access them directly.
 */
 
class ListElement {
   public:
     ListElement(void *itemPtr, int sortKey);  /* initialize a list element */

     ListElement *next;		/* next element on list, 
				   NULL if this is the last */
     int key;		    	/* priority, for a sorted list */
     void *item; 	    	/* pointer to item on the list */
};

/* The following class defines a "list" -- a singly linked list of
 * list elements, each of which points to a single item on the list.
 *
 */
 
class List1 {
  public:
    List1();   /* de-allocate the list */
    ~List1();   /* */


    bool IsEmpty();		/* is the list empty? */
    void Insert(void *item, int sortKey);	/* Put item into list */
    void *Remove(int *keyPtr); 	  	/* Remove first item from list */

  private:
    ListElement *first;  	/* Head of the list, NULL if list is empty */
    ListElement *last;		/* Last element of list */
};

#endif /* _LIST_H */





⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?