var
MyQueue:TQueue; //声明队变量
ARecord:^MyName; //一个指针
i:integer;
ss:String;
{初始化部分}
MyQueue:=TQueue.Create();
{Push部分}
for i=0 to 10 do
begin
New(ARecord);//给指针空间
ARecord^.filename:=IntToStr(i);
MyQueue.Push(ARecord);//进队
end;
{Pop部分}
for :=0 to (MyQueue.Count-1) do
begin
ARecord:=MyQueue.Pop;//出队
ss:=ARecord^.filename;
Dispose(ARecord); //清空指针
end;
{释放队的资源}
MyQueue.Free;
MyQueue:TQueue; //声明队变量
ARecord:^MyName; //一个指针
i:integer;
ss:String;
{初始化部分}
MyQueue:=TQueue.Create();
{Push部分}
for i=0 to 10 do
begin
New(ARecord);//给指针空间
ARecord^.filename:=IntToStr(i);
MyQueue.Push(ARecord);//进队
end;
{Pop部分}
for :=0 to (MyQueue.Count-1) do
begin
ARecord:=MyQueue.Pop;//出队
ss:=ARecord^.filename;
Dispose(ARecord); //清空指针
end;
{释放队的资源}
MyQueue.Free;