標準ではないので、CTypedPtrListを使って作る
AddToEnd()で追加してGetFromFront()で取得。
// キュークラス
// AddToEnd()にはnewしたオブジェクトを渡して
// GetFromFront()した後はコール元でdeleteすること。
class CMyQueue : public CTypedPtrList< CPtrList, MyData* >
{
public:
// Go to the end of the line
void AddToEnd( MyData* newData )
{ AddTail( newData ); } // End of the queue
// Get first element in line
BaloonData* GetFromFront()
{ return IsEmpty() ? NULL : RemoveHead(); }
// キューがあるか
BOOL ChkEmpty(){
return IsEmpty();
}
};
ネタ元