Ignore:
Timestamp:
Oct 29, 2010, 7:49:29 AM (14 years ago)
Author:
george
Message:
  • Added: Partial generic set implementation.
  • Modified: TGStack, TGQueue and TGSet owns TGList instead of inherits.
  • Added: TList and TListPointer benchmark comparasion.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Generics/TemplateGenerics/Generic/QueueImplementation.tpl

    r73 r76  
    55procedure TGQueue.Enqueue(Value: TQueueItem);
    66begin
    7   Add(Value);
     7  FList.Add(Value);
    88end;
    99
    1010function TGQueue.Peek: TQueueItem;
    1111begin
    12   Result := First;
     12  Result := FList.First;
     13end;
     14
     15constructor TGQueue.Create;
     16begin
     17  FList := TGList.Create;
     18end;
     19
     20destructor TGQueue.Destroy;
     21begin
     22  FList.Free;
     23  inherited Destroy;
    1324end;
    1425
    1526function TGQueue.Dequeue: TQueueItem;
    1627begin
    17   Result := Extract(First);
     28  Result := FList.Extract(FList.First);
    1829end;
    1930
Note: See TracChangeset for help on using the changeset viewer.