page size macro/utility
This commit is contained in:
9
TODO
9
TODO
@@ -21,8 +21,7 @@
|
||||
* types defined at runtime that refer to the same compile-time type (but to different pools) are possible, the library is almost there
|
||||
* add take functionality, eg registry.take(entity, other); where it takes the entity and all its components from registry and move them to other
|
||||
* add entity function to views/groups (component -> owner, see sparse sets)
|
||||
|
||||
* what about paged pools? vector of fixed-size blocks (ease shared components, multi-ownership, etc).
|
||||
- still separate the three arrays, work with page size, not number of components, arrays don't have to have the same number of pages
|
||||
- opaque input iterator that returns a proxy object (tuple of entity+references) and each can hide the underlying details about paging
|
||||
- it can avoid [] most of the times, that annoying thing current it does and I dislike so much :-)
|
||||
* add opaque input iterators to views and groups that return tuples <entity, T &...> (proxy), multi-pass guaranteed
|
||||
* add fast lane for raw iterations, extend mt doc to describe allowed add/remove with pre-allocations on fast lanes
|
||||
* review sparse set to allow extrem customization (mix pack in the spec, base is position only)
|
||||
* paged reverse to reduce memory usage
|
||||
|
||||
@@ -39,4 +39,9 @@ using maybe_atomic_t = Type;
|
||||
#endif // ENTT_ENTITY_TYPE
|
||||
|
||||
|
||||
#ifndef ENTT_PAGE_SIZE
|
||||
#define ENTT_PAGE_SIZE 32768
|
||||
#endif
|
||||
|
||||
|
||||
#endif // ENTT_CONFIG_CONFIG_H
|
||||
|
||||
@@ -65,6 +65,19 @@ template<class Type>
|
||||
constexpr auto is_named_type_v = is_named_type<Type>::value;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Helper variable template.
|
||||
*
|
||||
* `ENTT_PAGE_SIZE` if it's a power of two, a compilation error otherwise.
|
||||
*/
|
||||
constexpr auto page_size_v = []() constexpr {
|
||||
constexpr auto size = ENTT_PAGE_SIZE;
|
||||
// compile-time assertion if page size isn't a power of two
|
||||
static_assert(size && ((size & (size - 1)) == 0));
|
||||
return size;
|
||||
}();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +99,9 @@ constexpr auto is_named_type_v = is_named_type<Type>::value;
|
||||
template<>\
|
||||
struct entt::named_type_traits<type>\
|
||||
: std::integral_constant<typename entt::hashed_string::hash_type, entt::hashed_string::to_value(#type)>\
|
||||
{};
|
||||
{\
|
||||
static_assert(std::is_same_v<std::decay_t<type>, type>);\
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user