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

Clean up static_cast enum messes #5

Open
kc9jud opened this issue Aug 15, 2019 · 0 comments
Open

Clean up static_cast enum messes #5

kc9jud opened this issue Aug 15, 2019 · 0 comments

Comments

@kc9jud
Copy link
Contributor

kc9jud commented Aug 15, 2019

Currently there are many places with code like

char radial_operator_type_c;
line_stream >> radial_operator_type_c;
shell::RadialOperatorType radial_operator_type = static_cast<shell::RadialOperatorType>(radial_operator_type_c);

or

std::string operator_species_s;
line_stream >> operator_species_s;
basis::OperatorTypePN operator_species = kCharCodeOperatorTypePN.at(operator_species_s);

There are also analogous lookups going the other direction, from enum->string/char. This is dangerous and not type-safe. This should be replaced with some templatized lookup functions, perhaps like https://github.com/andrewstephens75/EnumMapping

This probably belongs in https://github.com/nd-nuclear-theory/mcutils

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

No branches or pull requests

1 participant