Fix #define min/max problem from Windows.h

This commit is contained in:
Chuvi
2021-07-12 09:56:08 +03:00
parent e34840ab0d
commit 28a81289a6
5 changed files with 13 additions and 13 deletions

View File

@@ -122,7 +122,7 @@ public:
size_t current() {
std::lock_guard<std::mutex> lock{mutex_};
return std::min(static_cast<size_t>(progress_),
return (std::min)(static_cast<size_t>(progress_),
size_t(get_value<details::ProgressBarOption::max_progress>()));
}
@@ -179,7 +179,7 @@ private:
auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(now - start_time_point_);
if (get_value<details::ProgressBarOption::show_percentage>()) {
os << " " << std::min(static_cast<size_t>(progress_ / max_progress * 100.0), size_t(100))
os << " " << (std::min)(static_cast<size_t>(progress_ / max_progress * 100.0), size_t(100))
<< "%";
}

View File

@@ -110,7 +110,7 @@ public:
std::ostream &write(float progress) {
std::string fill_text{""};
std::vector<std::string> lead_characters{" ", "", "", "", "", "", "", ""};
auto value = std::min(1.0f, std::max(0.0f, progress / 100.0f));
auto value = (std::min)(1.0f, (std::max)(0.0f, progress / 100.0f));
auto whole_width = std::floor(value * bar_width);
auto remainder_width = fmod((value * bar_width), 1.0f);
auto part_width = std::floor(remainder_width * lead_characters.size());

View File

@@ -166,7 +166,7 @@ public:
size_t current() {
std::lock_guard<std::mutex> lock{mutex_};
return std::min(
return (std::min)(
progress_,
size_t(get_value<details::ProgressBarOption::max_progress>()));
}
@@ -231,7 +231,7 @@ private:
if (get_value<details::ProgressBarOption::show_percentage>()) {
os << " "
<< std::min(static_cast<size_t>(static_cast<float>(progress_) /
<< (std::min)(static_cast<size_t>(static_cast<float>(progress_) /
max_progress * 100),
size_t(100))
<< "%";

View File

@@ -123,7 +123,7 @@ public:
size_t current() {
std::lock_guard<std::mutex> lock{mutex_};
return std::min(progress_, size_t(get_value<details::ProgressBarOption::max_progress>()));
return (std::min)(progress_, size_t(get_value<details::ProgressBarOption::max_progress>()));
}
bool is_completed() const { return get_value<details::ProgressBarOption::completed>(); }