バナーをクリックすれば目次に戻ります
Copyright 1999 Rogue Wave Software
Copyright 1999 Sun Microsystems, Inc.
RWGDlist(type)
#include <rw/gdlist.h> declare(RWGDlist, type) RWGDlist(type) a;
RWBoolean yourTesterFunction(const type* c, const void* d);引数 c は、一致するかどうかを調べるコレクション内の要素です。引数 d を yourTesterFunction() に渡して c と d が一致すれば、関数は TRUE を返します。
記述を簡単にするため、テスト関数に対して次のような仮想の typedef が使用されています。
typedef RWBoolean (*yourTester)(const type*, const void*);
#include <rw/gdlist.h>
#include <rw/rstream.h>
declare(RWGDlist,int) /* 整数のリストを宣言する */
main() {
RWGDlist(int) list; // 整数のリストを定義する
int *ip;
list.insert(new int(5)); // 整数を挿入する
list.insert(new int(7));
list.insert(new int(1));
list.prepend(new int(11));
RWGDlistIterator(int) next(list);
while(ip = next() )
cout << *ip << endl; // メンバーを出力する
while(!list.isEmpty())
delete list.get(); // リスト項目を削除する
return 0;
}
END FILE
|
11
5
7
1
|
RWGDlist(type)();
RWGDlist(type)(type* a);
RWGDlist(type)(const RWGDlist(type)& a);
void operator=(const RWGDlist(type)& a);
type* append(type* a);
void apply(void (*ap)(type*, void*), void* );
void yourApplyFunction(type* c, void*);
type*& at(size_t i); const type* at(size_t i) const;
void clear();
RWBoolean contains(yourTester t, const void* d) const;
RWBoolean containsReference(const type* e) const;
size_t entries() const;
type* find(yourTester t, const void* d) const;
type* findReference(const type* e) const;
type* first() const;
type* get();
type* insert(type* e);
void insertAt(size_t indx, type* e);
RWBoolean isEmpty() const;
type* last() const;
size_t occurrencesOf(yourTester t, const void* d) const;
size_t occurrencesOfReference(const type* e) const;
type* prepend(type* a);
type* remove(yourTester t, const void* d);
type* removeReference(const type* e);
