Skip to content

Make modify_cast more powerful#1884

Open
nytelytee wants to merge 3 commits intogeode-sdk:mainfrom
nytelytee:modify-cast
Open

Make modify_cast more powerful#1884
nytelytee wants to merge 3 commits intogeode-sdk:mainfrom
nytelytee:modify-cast

Conversation

@nytelytee
Copy link
Contributor

The original modify_cast was only able to cast a non-modify class to a modify class.

This pull request enables it to do the reverse, cast from a modify class to a non-modify class as well.

It also enables it to cast between 2 modify classes.

@nytelytee
Copy link
Contributor Author

nytelytee commented Mar 1, 2026

One additional question I forgot:
would you be fine with me also adding a modify_typeinfo_cast that will do a typeinfo_cast at the right place in the cast chain, so that one can also use this at runtime? I think that at each of the 3 branches, only 1 typeinfo_cast is necessary, when switching between base types. The requires from the static asserts in the branches can also be removed in that case, I think.

Also the void checks inside of the static asserts in the branches may be redundant given that the concept in the if constexpr already checks for that. Hence, in the typeinfo_cast version, the entire static asserts could be removed altogether.

@nytelytee
Copy link
Contributor Author

Does Geode have a style guide for concept names? I named a concept IsRealModify, but am not sure if I should have used snake_case or not.

@dankmeme01
Copy link
Member

looking at source it's inconsistent but mostly PascalCase

I copied my implementation after testing it, it was named custom_modify_cast and I forgot to change the name back before PRing. Oops.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants