Skip to content

Add ADL way of defining enum_range#413

Merged
Neargye merged 1 commit intoNeargye:masterfrom
ZXShady:adl_ranges
Jun 11, 2025
Merged

Add ADL way of defining enum_range#413
Neargye merged 1 commit intoNeargye:masterfrom
ZXShady:adl_ranges

Conversation

@ZXShady
Copy link
Copy Markdown
Contributor

@ZXShady ZXShady commented Jun 9, 2025

Implements #381

Copy link
Copy Markdown
Contributor

@lsemprini lsemprini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat! Much cleaner than my code.

What cases is magic_enum::customize::adl_info<true> meant to be used for?

Looks like line 196 of include/magic_enum/magic_enum.hpp should say bool instead of int

Thanks!

@ZXShady
Copy link
Copy Markdown
Contributor Author

ZXShady commented Jun 9, 2025

Neat! Much cleaner than my code.

What cases is magic_enum::customize::adl_info<true> meant to be used for?

Looks like line 196 of include/magic_enum/magic_enum.hpp should say bool instead of int

Thanks!

adl_info<true> means is_flags is true while adl_info<-10,10> means min max range

and good catch for the int in is_flags surprised I got no warnings (likely because it is all constexpr and the conversion is valid)

@lsemprini
Copy link
Copy Markdown
Contributor

I see. We should add documentation too. I made suggested documentation changes in doc/limitations.md and doc/reference.md in my repository (that was a fork of your repository) and submitted a pull request. I have no idea what I'm doing with GitHub, so apologies if I'm using the wrong features to do the suggestion. I can submit the files another way if you like.

ZXShady#1

Co-Authored-By: ZXShady <153229951+ZXShady@users.noreply.github.com>
Co-Authored-By: lsemprini <17140216+lsemprini@users.noreply.github.com>
@Neargye
Copy link
Copy Markdown
Owner

Neargye commented Jun 11, 2025

Thanks!

@Neargye Neargye merged commit d642b05 into Neargye:master Jun 11, 2025
15 of 19 checks passed
@ZXShady ZXShady deleted the adl_ranges branch June 11, 2025 17:02
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.

3 participants