Skip to content

Clean up static_cast enum messes #5

@kc9jud

Description

@kc9jud

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions