Skip to content

Commit 7dd90c9

Browse files
committed
don't force spilling to stack in range validators
1 parent dbc1ce4 commit 7dd90c9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

include/adm/detail/named_type_validators.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace adm {
2929
/// the type, so reduces duplication
3030
template <typename T>
3131
struct ValidateRangeHelper {
32-
static void validateRange(const T& value, int minValue, int maxValue) {
32+
static void validateRange(T value, int minValue, int maxValue) {
3333
if (value > static_cast<T>(maxValue) ||
3434
value < static_cast<T>(minValue)) {
3535
std::stringstream msg;
@@ -39,15 +39,15 @@ namespace adm {
3939
}
4040
}
4141

42-
static void validateMin(const T& value, int minValue) {
42+
static void validateMin(T value, int minValue) {
4343
if (value < static_cast<T>(minValue)) {
4444
std::stringstream msg;
4545
msg << "'" << value << "'' is not bigger than '" << minValue << "'";
4646
throw OutOfRangeError(msg.str());
4747
}
4848
}
4949

50-
static void validateMax(const T& value, int maxValue) {
50+
static void validateMax(T value, int maxValue) {
5151
if (value > static_cast<T>(maxValue)) {
5252
std::stringstream msg;
5353
msg << "'" << value << "'' is not smaller than '" << maxValue << "'";
@@ -74,23 +74,23 @@ namespace adm {
7474
template <int minValue, int maxValue>
7575
struct RangeValidator {
7676
template <typename T>
77-
static void validate(const T& value) {
77+
static void validate(T value) {
7878
ValidateRangeHelper<T>::validateRange(value, minValue, maxValue);
7979
}
8080
};
8181

8282
template <int minValue>
8383
struct MinValidator {
8484
template <typename T>
85-
static void validate(const T& value) {
85+
static void validate(T value) {
8686
ValidateRangeHelper<T>::validateMin(value, minValue);
8787
}
8888
};
8989

9090
template <int maxValue>
9191
struct MaxValidator {
9292
template <typename T>
93-
static void validate(const T& value) {
93+
static void validate(T value) {
9494
ValidateRangeHelper<T>::validateMax(value, maxValue);
9595
}
9696
};

0 commit comments

Comments
 (0)