Add #pragmas in ecs::accessor to silence false-positive dangling reference warning in GCC

This commit is contained in:
Nikita Lisitsa 2024-05-21 13:22:27 +03:00
parent d9935c7476
commit 933874eddf

View file

@ -93,6 +93,9 @@ namespace psemek::ecs
return reinterpret_cast<Component *>(column->data() + detail::stride<Component>() * row_);
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdangling-reference"
template <typename Component>
Component & accessor::get()
{
@ -109,6 +112,8 @@ namespace psemek::ecs
throw component_not_found_exception(typeid(std::remove_const_t<Component>), table_->entity_handles()[row_]);
}
#pragma GCC diagnostic pop
template <typename Component>
bool accessor::contains() const
{