Bart via fpc-devel <fpc-devel@lists.freepascal.org> schrieb am Do., 25. Apr. 2024, 11:48:
> > > Then declare a Copy management operator in the record. Unlike an > assignment operator these *must* be part of the record, thus the same rules > are applied for the same type everywhere unlike for operator overloads. See > also https://wiki.freepascal.org/management_operators > > So, I would have to declare something like this? > > class operator TArr.Copy(constref aSrc: TArr; var aDst: TArr); > begin > aDst.A := Copy(aSrc.A); > end; > > And then in my example: > > R1.A := [1,2,3]; > R2 := R1; > --> R2.A will be (1,2,3), and changing that will not affect R1.A anymore > Correct. > Sounds like a nice feature to have (in 3.4). > Management operators are already part of 3.2.x ( https://wiki.freepascal.org/FPC_New_Features_3.2.0#Management_operators_for_record_types ). Or did I misunderstand your remark? 🤔 > I'll write some tests to get familiar with this and if I don't forget > I'll write a simple example in the wiki (there's a ToDo for that > currently). > Please do. 😊 Regards, Sven >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel