Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for clash with Windows "min" and "max" macros #52

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/ankerl/svector.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class header {
template <typename T>
struct storage : public header {
static constexpr auto alignment_of_t = std::alignment_of_v<T>;
static constexpr auto max_alignment = std::max(std::alignment_of_v<header>, std::alignment_of_v<T>);
static constexpr auto max_alignment = (std::max)(std::alignment_of_v<header>, std::alignment_of_v<T>);
static constexpr auto offset_to_data = detail::round_up(sizeof(header), alignment_of_t);
static_assert(max_alignment <= __STDCPP_DEFAULT_NEW_ALIGNMENT__);

Expand Down Expand Up @@ -164,7 +164,7 @@ struct storage : public header {
throw std::bad_alloc();
}
mem += offset_to_data;
if (static_cast<uint64_t>(mem) > static_cast<uint64_t>(std::numeric_limits<std::ptrdiff_t>::max())) {
if (static_cast<uint64_t>(mem) > static_cast<uint64_t>((std::numeric_limits<std::ptrdiff_t>::max)())) {
throw std::bad_alloc();
}

Expand Down Expand Up @@ -317,7 +317,7 @@ class svector {
// got an overflow, set capacity to max
new_capacity = max_size();
}
return std::min(new_capacity, max_size());
return (std::min)(new_capacity, max_size());
}

template <direction D>
Expand Down Expand Up @@ -846,7 +846,7 @@ class svector {
}

[[nodiscard]] static auto max_size() -> size_t {
return std::numeric_limits<std::ptrdiff_t>::max();
return (std::numeric_limits<std::ptrdiff_t>::max)();
}

void swap(svector& other) {
Expand Down