mirror of
https://github.com/red0124/ssp.git
synced 2025-12-14 21:59:55 +01:00
add lt gt lte gte restrictions, update unit tests, update documentation
This commit is contained in:
@@ -52,6 +52,41 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
////////////////
|
||||
// greater than or equal to
|
||||
// greater than
|
||||
// less than
|
||||
// less than or equal to
|
||||
////////////////
|
||||
|
||||
template <typename T, auto N>
|
||||
struct gt {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value > N;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, auto N>
|
||||
struct gte {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value >= N;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, auto N>
|
||||
struct lt {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value < N;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, auto N>
|
||||
struct lte {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value <= N;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////
|
||||
// in range
|
||||
////////////////
|
||||
@@ -61,10 +96,6 @@ struct ir {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value >= Min && value <= Max;
|
||||
}
|
||||
|
||||
const char* error() const {
|
||||
return "out of range";
|
||||
}
|
||||
};
|
||||
|
||||
////////////////
|
||||
@@ -76,10 +107,6 @@ struct oor {
|
||||
bool ss_valid(const T& value) const {
|
||||
return value < Min || value > Max;
|
||||
}
|
||||
|
||||
const char* error() const {
|
||||
return "in restricted range";
|
||||
}
|
||||
};
|
||||
|
||||
////////////////
|
||||
|
||||
Reference in New Issue
Block a user