[fpc-pascal] Re: Can it map class type as key?
1123monkey at gmail.com
Thu Apr 26 13:17:26 CEST 2012
Yes, I didn't clearly understand the generic mechanism in fpc/tfpgmap.
I've read, `A class can be seen as a pointer to an object, or a pointer to a record, with methods associated with it.' in fpc reference.pdf, chapter 6 - Classes. Hence I think fpc takes object as pointer when specialize tfpgmap template.
Now I catch your idea. The specialization of tfpgmap is similar to std::map in C++ (must define a (bool operator<(ref to another obj)const) function for the KEY class).
I'll read the source code of unit fgl to deepen understanding.
Thank you very much.
On 04/26/2012 06:25 PM, JC Chu wrote:
> I’m not quite getting what you’re trying to say… Free Pascal and Delphi
> do have distinct syntaxes for generic type definition and
> specialization. You may want to consult respective documentations to
> clarify your understanding of the code.
> ◦ Delphi ―
> ◦ Free Pascal ―
> Hope it helps.
More information about the fpc-pascal