Function get_as_tuple

Synopsis

#include <src/entt/entity/storage.hpp>

template <typename Type>
auto get_as_tuple([[maybe_unused]] Type &container, [[maybe_unused]] const typename Type::entity_type entity)

Description

Gets the element associated with an entity from a storage, if any.

Template Parameters

Type - Storage type.

Parameters

container - A valid instance of a storage class.

entity - A valid entity identifier.

Return
A possibly empty tuple containing the requested element.

Source

Lines 816-824 in src/entt/entity/storage.hpp.

template<typename Type>
[[nodiscard]] auto get_as_tuple([[maybe_unused]] Type &container, [[maybe_unused]] const typename Type::entity_type entity) {
    if constexpr(std::is_same_v<typename Type::storage_category, empty_storage_tag>) {
        return std::make_tuple();
    } else {
        static_assert(std::is_same_v<typename Type::storage_category, dense_storage_tag>, "Unknown storage category");
        return std::forward_as_tuple(container.get(entity));
    }
}





Add Discussion

Log in to comment