<span style="font-family:courier new,monospace">Hi, <br><br>I try to do exactly the same as show here:<br><br><br>QUOTE: <a href="http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-stl/src/gvector.pp">http://svn.freepascal.org/svn/fpc/trunk/packages/fcl-stl/src/gvector.pp</a><br>
</span><pre><span style="font-family:courier new,monospace">generic TVector<T> = class
... ...<br> type
TVectorEnumerator = class
private
FVector: TVector;
FPosition: SizeUInt;
FFirstDone: Boolean;
function GetCurrent: T; inline;
public
<b><span style="color:rgb(255,0,0)">constructor Create(AVector: TVector);</span></b>
function MoveNext: Boolean; inline;
property Current: T read GetCurrent;
end;
... ...
public<br><br>My code:<br><br>generic TTreap<TKey, TValue> = class<br> ... ...<br> type<br> TTreapEnumerator = class<br> FStack: TStack;<br> FCurrent: PNode;<br> public<br> <span style="color:rgb(255,0,0)"><b>constructor Create(ATreap: TTreap);</b></span><br>
destructor Destroy; override;<br> function MoveNext: Boolean;<br> property Current: PNode read FCurrent;<br> end;<br> ... ...<br> private <br><br>Error message I got is: Error: Generics without specialization cannot be used as a type for a variable<br>
<br>Then I found this: </span><span style="font-family:courier new,monospace"><a href="http://bugs.freepascal.org/view.php?id=19499&history=1">http://bugs.freepascal.org/view.php?id=19499&history=1</a><br><br>I wonder if this bug's fix is release or not? How does the TVector class compile with this problem?<br>
<br>Thanks!<br>Xiangrong<br></span></pre>