Skip to content
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

Use name pointer for internal type identification #8

Conversation

FlorianRhiem
Copy link
Contributor

This is a possible solution to the problem with CLASS_NAMEs in shared libraries discussed in #7. Types have the string as a non-constexpr static member and have a pointer to that static member as the constexpr that is used in comparisons etc. This way you have both a human-readable representation and a constexpr, with the difference that it must work thanks to the one definition rule.

A few things you might want to do differently to this branch:

  • I have added the namePtr to Type and kept the name for the sake of simplicity. If you don't want to waste the memory of keeping name around, it could be a method that simply dereferences namePtr.
  • I have kept the name CLASS_NAME and called the non-constexpr string CLASS_NAME_NONCONSTEXPR. CLASS_NAMEPTR and CLASS_NAME might be better names, but they would require larger changes to the existing code.

@lganzzzo
Copy link
Member

please change target branch to
data_mapping_type_id_refactoring

@FlorianRhiem FlorianRhiem changed the base branch from master to data_mapping_type_id_refactoring October 12, 2018 05:09
@lganzzzo
Copy link
Member

Fixed in #17

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.

None yet

2 participants