Skip to content

Commit

Permalink
Microsoft's rpcndr.h defines a macro called "small".
Browse files Browse the repository at this point in the history
We can't use this as a name for anything in our code.
  • Loading branch information
paulhuggett committed Oct 20, 2023
1 parent 1808a79 commit 3cbdf27
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions include/peejay/small_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ class small_vector {
std::is_nothrow_invocable_v<Visitor, small_type>
&&std::is_nothrow_invocable_v<Visitor, large_type>) {
assert (!sv.arr_.valueless_by_exception ());
if (auto *const small = std::get_if<small_type> (&sv.arr_)) {
return visitor (*small);
if (auto *const s = std::get_if<small_type> (&sv.arr_)) {
return visitor (*s);
}
if (auto *const large = std::get_if<large_type> (&sv.arr_)) {
return visitor (*large);
if (auto *const l = std::get_if<large_type> (&sv.arr_)) {
return visitor (*l);
}
unreachable ();
}
Expand Down Expand Up @@ -626,14 +626,13 @@ template <typename ElementType, std::size_t BodyElements, typename Allocator>
void small_vector<ElementType, BodyElements, Allocator>::assign (
size_type count, const_reference value) {
if (count <= BodyElements) {
if (auto *const small = std::get_if<small_type> (&arr_)) {
small->assign (static_cast<typename small_type::size_type> (count),
value);
if (auto *const s = std::get_if<small_type> (&arr_)) {
s->assign (static_cast<typename small_type::size_type> (count), value);
return;
}
}
if (auto *const large = std::get_if<large_type> (&arr_)) {
large->assign (count, value);
if (auto *const l = std::get_if<large_type> (&arr_)) {
l->assign (count, value);
} else {
large_type vec (count, value);
static_assert (std::is_nothrow_move_constructible_v<large_type>);
Expand Down

0 comments on commit 3cbdf27

Please sign in to comment.