compressed_pair:
* disable structured binding support for clang 6 * avoid using structured binding with compressed pair in the codebase
This commit is contained in:
@@ -266,6 +266,8 @@ inline void swap(compressed_pair<First, Second> &lhs, compressed_pair<First, Sec
|
||||
|
||||
|
||||
namespace std {
|
||||
// disable structured binding support for clang 6, it messes when specializing tuple_size
|
||||
#if !defined __clang_major__ || __clang_major__ > 6
|
||||
template<typename First, typename Second>
|
||||
struct tuple_size<entt::compressed_pair<First, Second>>: integral_constant<size_t, 2u> {};
|
||||
|
||||
@@ -273,6 +275,7 @@ namespace std {
|
||||
struct tuple_element<Index, entt::compressed_pair<First, Second>>: conditional<Index == 0u, First, Second> {
|
||||
static_assert(Index < 2u, "Index out of bounds");
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,7 +200,8 @@ class basic_sparse_set {
|
||||
}
|
||||
|
||||
void resize_packed_array(const std::size_t req) {
|
||||
auto &&[allocator, len] = reserved;
|
||||
auto &allocator = reserved.first();
|
||||
auto &len = reserved.second();
|
||||
ENTT_ASSERT((req != len) && !(req < count), "Invalid request");
|
||||
const auto mem = alloc_traits::allocate(allocator, req);
|
||||
|
||||
@@ -217,7 +218,8 @@ class basic_sparse_set {
|
||||
}
|
||||
|
||||
void release_memory() {
|
||||
auto &&[allocator, len] = reserved;
|
||||
auto &allocator = reserved.first();
|
||||
auto &len = reserved.second();
|
||||
|
||||
if(packed_array) {
|
||||
std::destroy(packed_array, packed_array + len);
|
||||
|
||||
@@ -184,7 +184,8 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
|
||||
// no-throw stable erase iteration
|
||||
base_type::clear();
|
||||
|
||||
auto &&[allocator, len] = bucket;
|
||||
auto &allocator = bucket.first();
|
||||
auto &len = bucket.second();
|
||||
alloc_ptr allocator_ptr{allocator};
|
||||
|
||||
for(size_type pos{}; pos < len; ++pos) {
|
||||
@@ -198,7 +199,8 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
|
||||
|
||||
void assure_at_least(const std::size_t pos) {
|
||||
if(const auto idx = page(pos); !(idx < bucket.second())) {
|
||||
auto &&[allocator, len] = bucket;
|
||||
auto &allocator = bucket.first();
|
||||
auto &len = bucket.second();
|
||||
alloc_ptr allocator_ptr{allocator};
|
||||
|
||||
const size_type sz = idx + 1u;
|
||||
@@ -232,7 +234,8 @@ class basic_storage: public basic_sparse_set<Entity, typename std::allocator_tra
|
||||
|
||||
void release_unused_pages() {
|
||||
if(const auto length = base_type::size() / packed_page; length < bucket.second()) {
|
||||
auto &&[allocator, len] = bucket;
|
||||
auto &allocator = bucket.first();
|
||||
auto &len = bucket.second();
|
||||
alloc_ptr allocator_ptr{allocator};
|
||||
|
||||
const auto mem = alloc_ptr_traits::allocate(allocator_ptr, length);
|
||||
|
||||
Reference in New Issue
Block a user