Skip to content

Utility functions to transform enum to string and back. #102

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

Closed
diptorupd opened this issue Oct 5, 2020 · 0 comments · Fixed by #148
Closed

Utility functions to transform enum to string and back. #102

diptorupd opened this issue Oct 5, 2020 · 0 comments · Fixed by #148
Assignees
Milestone

Comments

@diptorupd
Copy link
Contributor

diptorupd commented Oct 5, 2020

Looks like a duplication. I see this code above. It is better to create function which transforms enum to string and back.

Originally posted by @PokhodenkoSA in #93 (comment)

Example code:

case info::device_type::cpu:

case info::device_type::cpu:

Both examples contain conversion from enum to string. It is a code duplication and could be refactored into single function.
Also it is a good design to create pairs of functions to convert enum to string and string to enum.

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 a pull request may close this issue.

2 participants