<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Amir <<a href="mailto:Amir@aavani.net">Amir@aavani.net</a>> schrieb am So., 15. Apr. 2018, 23:51:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br>
<br>
Currently, FPC allows declaring objects as<br>
var<br>
MyMap: specialize TFPGMap<AnsiString, MyData>;<br>
<br>
This is very nice feature since I do not need define every Map/List/etc <br>
as a separate type.<br>
<br>
But to create MyMap object, one has to write something like:<br>
MyMap := (specialize TFPGMap<AnsiString, MyData>).Create()<br>
<br>
Wondering if there is any shorter way to handle the objects' <br>
initialization, .e.g., something like<br>
MyMap := auto.Create;<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Just declare a type for the specialization:</div><div dir="auto"><br></div><div dir="auto">=== code begin ===</div><div dir="auto"><br></div><div dir="auto">type</div><div dir="auto"> TMyDataMap = specialize <span style="font-family:sans-serif">TFPGMap<AnsiString, MyData>;</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">var</span></div><div dir="auto"><span style="font-family:sans-serif"> MyData: TMyDataMap;</span></div><div dir="auto"><span style="font-family:sans-serif">begin</span></div><div dir="auto"><span style="font-family:sans-serif"> MyData := TMyDataMap.Create;</span></div><div dir="auto"><span style="font-family:sans-serif">end. </span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">=== code end ===</span></div><div dir="auto"><span style="font-family:sans-serif"><br></span></div><div dir="auto"><span style="font-family:sans-serif">Regards, </span></div><div dir="auto"><span style="font-family:sans-serif">Sven </span></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>