Skip to content

Commit 61a70a7

Browse files
committed
Don't use intermediate variables for the bounds of std::common_type.
1 parent e5a066a commit 61a70a7

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

source/bounded/integer.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,16 @@ constexpr auto builtin_min_value<integer<minimum, maximum>> = minimum;
5959

6060
template<bounded::bounded_integer LHS, bounded::bounded_integer RHS> requires std::same_as<LHS, std::decay_t<LHS>> and std::same_as<RHS, std::decay_t<RHS>>
6161
struct std::common_type<LHS, RHS> {
62-
private:
63-
static inline constexpr auto minimum = bounded::normalize<bounded::safe_min(
64-
bounded::builtin_min_value<LHS>,
65-
bounded::builtin_min_value<RHS>
66-
)>;
67-
static inline constexpr auto maximum = bounded::normalize<bounded::safe_max(
68-
bounded::builtin_max_value<LHS>,
69-
bounded::builtin_max_value<RHS>
70-
)>;
71-
public:
72-
using type = bounded::integer<minimum, maximum>;
62+
using type = bounded::integer<
63+
bounded::normalize<bounded::safe_min(
64+
bounded::builtin_min_value<LHS>,
65+
bounded::builtin_min_value<RHS>
66+
)>,
67+
bounded::normalize<bounded::safe_max(
68+
bounded::builtin_max_value<LHS>,
69+
bounded::builtin_max_value<RHS>
70+
)>
71+
>;
7372
};
7473

7574
namespace bounded {

0 commit comments

Comments
 (0)