Skip to content

Commit 1d070ae

Browse files
committed
Move min_max type used in bounded arithmetic to its own module.
1 parent 95c4443 commit 1d070ae

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

source/bounded/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ target_sources(bounded PUBLIC
3232
arithmetic/increment_decrement.cpp
3333
arithmetic/modulus.cpp
3434
arithmetic/multiplies.cpp
35+
arithmetic/min_max.cpp
3536
arithmetic/operators_builtin.cpp
3637
arithmetic/operators.cpp
3738
arithmetic/plus.cpp

source/bounded/arithmetic/divides.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
export module bounded.arithmetic.divides;
77

88
import bounded.arithmetic.extreme_values;
9+
import bounded.arithmetic.min_max;
910
import bounded.arithmetic.safe_abs;
1011
import bounded.arithmetic.unary_minus;
1112
import bounded.bounded_integer;
@@ -22,12 +23,6 @@ import std_module;
2223

2324
namespace bounded {
2425

25-
template<typename Min, typename Max>
26-
struct min_max {
27-
Min min;
28-
Max max;
29-
};
30-
3126
template<bool condition>
3227
constexpr auto conditional_function(auto if_true, auto if_false) {
3328
if constexpr (condition) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright David Stone 2024.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
export module bounded.arithmetic.min_max;
7+
8+
namespace bounded {
9+
10+
export template<typename Min, typename Max>
11+
struct min_max {
12+
Min min;
13+
Max max;
14+
};
15+
16+
} // namespace bounded

source/bounded/arithmetic/modulus.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
export module bounded.arithmetic.modulus;
77

88
import bounded.arithmetic.extreme_values;
9+
import bounded.arithmetic.min_max;
910
import bounded.arithmetic.safe_abs;
1011
import bounded.bounded_integer;
1112
import bounded.comparison;
@@ -20,11 +21,6 @@ import std_module;
2021

2122
namespace bounded {
2223

23-
template<typename Min, typename Max>
24-
struct min_max {
25-
Min min;
26-
Max max;
27-
};
2824

2925
using smax_t = numeric_traits::max_signed_t;
3026
using umax_t = numeric_traits::max_unsigned_t;

0 commit comments

Comments
 (0)