Closed sonygod closed 1 year ago
May be your code is for some reason.
The goal of designing the struct in this way is to provide multiple ways of constructing Person objects based on different scenarios. By including these various constructor options, the struct becomes more versatile, allowing users to create Person objects using their preferred method based on the available data or requirements.
Yes! Apologies for the delay, but a Haxe "anonymous structure" is very different from a C++ struct. An anonymous structure needs to be able to be assigned from any object with the same fields, like this:
class Test { var a: Int = 0; }
function main() {
final test = new Test();
doThing(test);
}
function doThing(num: { a: Int }) {
// do something with an object with "a: Int"
}
So that's why there needs to be a lot of boilerplate. If you want a "struct", you can create a Haxe class with just fields in it. class
and struct
do the same thing in C++ afaik!
I think your struct generation is a bit redundant.
and your code
I think it's too heavy to use .
why not like this ?