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

strong_typedef: numeric_limits #129

Open
BrukerJWD opened this issue Apr 20, 2022 · 1 comment
Open

strong_typedef: numeric_limits #129

BrukerJWD opened this issue Apr 20, 2022 · 1 comment

Comments

@BrukerJWD
Copy link
Contributor

I'm new to this lib, but I like the idea very much.

What about numeric_limits?
I know that std::chrono:duration defines them on the type itself, but I would also be happy with some external limits type. What I don't like is this amount of characters:

struct my_type
    : type_safe::strong_typedef<my_type, std::int32_t>
    , type_safe::strong_typedef_op::equality_comparison<my_type>
    , type_safe::strong_typedef_op::relational_comparison<my_type>
    , type_safe::strong_typedef_op::integer_arithmetic<my_type>
{}
constexpr my_type max { std::numeric_limits<ts::underlying_type<my_type>>::max() };

what about something like my_type::max()?

@foonathan
Copy link
Owner

I'm not a big fan, as it requires a limit include and isn't such a common functionality.

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

2 participants