Skip to content

Commit 664dc4c

Browse files
committed
Replace Clamp function with standard library function
1 parent 7b18d86 commit 664dc4c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Main.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#include <iterator>
88

99
namespace {
10-
int Clamp(int upper, int lower, int value) {
11-
return std::max(lower, std::min(upper, value));
12-
}
13-
1410
int run(long argc, const char* argv[]) {
1511
ArgumentParser ap(argc, argv);
1612

@@ -19,7 +15,7 @@ namespace {
1915

2016
if (!ap.is("--help") && argc > 2) {
2117
auto minBlockSize = ap.getInt("-ml", MIN_BLOCK_SIZE);
22-
auto blockPercentThresholdValue = Clamp(100, 0, ap.getInt("-pt", 100));
18+
auto blockPercentThresholdValue = std::clamp(ap.getInt("-pt", 100), 0, 100);
2319
if (blockPercentThresholdValue < 0 || 100 < blockPercentThresholdValue) {
2420
throw std::runtime_error("-pt out of range");
2521
}

0 commit comments

Comments
 (0)