Use feature check for parenthesized aggregate initialization

This commit is contained in:
Charles Dang 2024-07-29 13:06:05 -04:00
parent bd819ced00
commit d77700f2f2
2 changed files with 7 additions and 5 deletions

View file

@ -1293,13 +1293,11 @@ void display::drawing_buffer_add(const drawing_layer layer, const map_location&
int(zoom_)
};
// C++20 needed for in-place aggregate initilization
#ifdef HAVE_CXX20
#ifdef __cpp_aggregate_paren_init
drawing_buffer_.emplace_back(generate_hex_key(layer, loc), draw_func, dest);
#else
draw_helper temp{generate_hex_key(layer, loc), draw_func, dest};
drawing_buffer_.push_back(std::move(temp));
#endif // HAVE_CXX20
drawing_buffer_.push_back({generate_hex_key(layer, loc), draw_func, dest});
#endif
}
void display::drawing_buffer_commit()

View file

@ -772,7 +772,11 @@ terrain_builder::terrain_constraint& terrain_builder::add_constraints(terrain_bu
if(!cons) {
// The terrain at the current location did not exist, so create it
#ifdef __cpp_aggregate_paren_init
constraints.emplace_back(loc);
#else
constraints.push_back({loc});
#endif
cons = &constraints.back();
}