type_safe icon indicating copy to clipboard operation
type_safe copied to clipboard

strong_typedef: numeric_limits

Open BrukerJWD opened this issue 2 years ago • 1 comments

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()?

BrukerJWD avatar Apr 20 '22 11:04 BrukerJWD

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

foonathan avatar Apr 21 '22 10:04 foonathan