minor changes

This commit is contained in:
Michele Caini
2019-08-08 17:04:45 +02:00
parent 6c40d8bd8b
commit 478eb7c5b5
4 changed files with 52 additions and 35 deletions

View File

@@ -9,44 +9,13 @@
#include "../core/type_traits.hpp"
#include "sparse_set.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "fwd.hpp"
namespace entt {
/**
* @brief Alias for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
struct exclude_t: type_list<Type...> {};
/**
* @brief Variable template for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr exclude_t<Type...> exclude{};
/**
* @brief Alias for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
struct get_t: type_list<Type...> {};
/**
* @brief Variable template for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr get_t<Type...> get{};
/**
* @brief Group.
*

View File

@@ -20,6 +20,7 @@
#include "sparse_set.hpp"
#include "snapshot.hpp"
#include "storage.hpp"
#include "utility.hpp"
#include "entity.hpp"
#include "group.hpp"
#include "view.hpp"
@@ -141,7 +142,7 @@ class basic_registry {
struct group_handler;
template<typename... Exclude, typename... Get>
struct group_handler<type_list<Exclude...>, type_list<Get...>>: sparse_set<Entity> {
struct group_handler<exclude_t<Exclude...>, get_t<Get...>>: sparse_set<Entity> {
std::tuple<pool_type<Get> *..., pool_type<Exclude> *...> cpools{};
template<typename Component>
@@ -168,7 +169,7 @@ class basic_registry {
};
template<typename... Exclude, typename... Get, typename... Owned>
struct group_handler<type_list<Exclude...>, type_list<Get...>, Owned...>: group_type {
struct group_handler<exclude_t<Exclude...>, get_t<Get...>, Owned...>: group_type {
std::tuple<pool_type<Owned> *..., pool_type<Get> *..., pool_type<Exclude> *...> cpools{};
template<typename Component>
@@ -1312,7 +1313,7 @@ public:
static_assert(sizeof...(Owned) + sizeof...(Get) > 0);
static_assert(sizeof...(Owned) + sizeof...(Get) + sizeof...(Exclude) > 1);
using handler_type = group_handler<type_list<Exclude...>, type_list<Get...>, Owned...>;
using handler_type = group_handler<exclude_t<Exclude...>, get_t<Get...>, Owned...>;
const std::size_t extent[] = { sizeof...(Owned), sizeof...(Get), sizeof...(Exclude) };
const ENTT_ID_TYPE types[] = { type<Owned>()..., type<Get>()..., type<Exclude>()... };

View File

@@ -0,0 +1,46 @@
#ifndef ENTT_ENTITY_UTILITY_HPP
#define ENTT_ENTITY_UTILITY_HPP
#include "../core/type_traits.hpp"
namespace entt {
/**
* @brief Alias for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
struct exclude_t: type_list<Type...> {};
/**
* @brief Variable template for exclusion lists.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr exclude_t<Type...> exclude{};
/**
* @brief Alias for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
struct get_t: type_list<Type...>{};
/**
* @brief Variable template for lists of observed components.
* @tparam Type List of types.
*/
template<typename... Type>
constexpr get_t<Type...> get{};
}
#endif // ENTT_ENTITY_UTILITY_HPP

View File

@@ -16,6 +16,7 @@
#include "entity/snapshot.hpp"
#include "entity/sparse_set.hpp"
#include "entity/storage.hpp"
#include "entity/utility.hpp"
#include "entity/view.hpp"
#include "locator/locator.hpp"
#include "meta/factory.hpp"