-
Notifications
You must be signed in to change notification settings - Fork 82
brutal hack to support std::variant
#686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Does this have any use? I don't see any variant in the current structures xml. |
|
we're prepping for 50.12, which does use |
there actually are several a better approach to specifying the type parameters of the |
50.12 beta is now public. So what is the plan? I'd like to add support df-structures 50.12 in my own library. |
|
our working solution is in the 5012-beta branches (both for dfhack and df-structures), but actual templated types is not yet implemented |
|
i've been thinking about how to do this over the past few weeks and have a kernel of a plan but i need to do some experimentation first. it may be a few weeks before a concrete proposal emerges note i am not claiming ownership of this problem and am more than willing to look at any reasonable approaches here. it has been over a decade since i did anything substantial with XSDs or XSLs and the rust here is very thick |
|
at the moment i'm looking at something akin to this:
there's a further extension (to be done later) for dealing with function types (which is what the type parameter of we'll probably eventually want to be able to declare templates as well; there is at least one template type in anyway, thoughts welcome none of this is set in stone, and i got nowhere when i tried a first pass at implementing this yesterday so i'm still at square one in this regard |
|
Thanks for the information. It looks fine for my usage. I cannot help with the codegen part though, I never looked up how it worked in details. |
this is a fairly brutal hack to allow
std::variantto appear in structuresthe attribute
raw-typeis used to specify the C++ type string that will appear between the brackets when instantiating the type. no processing of this type is done by codegen. note that<and>are special in XML and will have to be substituted by<and>note also that this does not deal with identity trait issues at all; an
OPAQUE_IDENTITY_TRAITwill be needed to be added toDataIdentity.handDataIdentity.cppfor each specialization ofstd::variantthat results from the use of this specification