core/entity: spot and remove useless add_const_t
This commit is contained in:
1
TODO
1
TODO
@@ -11,7 +11,6 @@ DOC:
|
||||
* examples (and credits) from @alanjfs :)
|
||||
|
||||
WIP:
|
||||
* spot and remove useless add_const_t
|
||||
* add storage getter for filters to views and groups
|
||||
* no () = default ctor for iterators with uninitialized members
|
||||
* remove storage::base_type, make views extract the sparse set directly
|
||||
|
||||
@@ -606,7 +606,7 @@ struct constness_as {
|
||||
template<typename To, typename From>
|
||||
struct constness_as<To, const From> {
|
||||
/*! @brief The type resulting from the transcription of the constness. */
|
||||
using type = std::add_const_t<To>;
|
||||
using type = const To;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,12 +34,12 @@ inline constexpr bool is_view_v = is_view<Type>::value;
|
||||
template<typename Type, typename Override>
|
||||
struct unpack_type {
|
||||
using ro = std::conditional_t<
|
||||
type_list_contains_v<Override, std::add_const_t<Type>> || (std::is_const_v<Type> && !type_list_contains_v<Override, std::remove_const_t<Type>>),
|
||||
type_list_contains_v<Override, const Type> || (std::is_const_v<Type> && !type_list_contains_v<Override, std::remove_const_t<Type>>),
|
||||
type_list<std::remove_const_t<Type>>,
|
||||
type_list<>>;
|
||||
|
||||
using rw = std::conditional_t<
|
||||
type_list_contains_v<Override, std::remove_const_t<Type>> || (!std::is_const_v<Type> && !type_list_contains_v<Override, std::add_const_t<Type>>),
|
||||
type_list_contains_v<Override, std::remove_const_t<Type>> || (!std::is_const_v<Type> && !type_list_contains_v<Override, const Type>),
|
||||
type_list<Type>,
|
||||
type_list<>>;
|
||||
};
|
||||
|
||||
@@ -174,8 +174,8 @@ struct registry_context {
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
[[nodiscard]] std::add_const_t<Type> &at(const id_type id = type_id<Type>().hash()) const {
|
||||
return any_cast<std::add_const_t<Type> &>(data.at(id));
|
||||
[[nodiscard]] const Type &at(const id_type id = type_id<Type>().hash()) const {
|
||||
return any_cast<const Type &>(data.at(id));
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
@@ -184,9 +184,9 @@ struct registry_context {
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
[[nodiscard]] std::add_const_t<Type> *find(const id_type id = type_id<Type>().hash()) const {
|
||||
[[nodiscard]] const Type *find(const id_type id = type_id<Type>().hash()) const {
|
||||
const auto it = data.find(id);
|
||||
return it != data.cend() ? any_cast<std::add_const_t<Type>>(&it->second) : nullptr;
|
||||
return it != data.cend() ? any_cast<const Type>(&it->second) : nullptr;
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
|
||||
@@ -34,7 +34,7 @@ class basic_snapshot {
|
||||
|
||||
template<typename Component, typename Archive, typename It>
|
||||
void get(Archive &archive, std::size_t sz, It first, It last) const {
|
||||
const auto view = reg->template view<std::add_const_t<Component>>();
|
||||
const auto view = reg->template view<const Component>();
|
||||
archive(typename entity_traits::entity_type(sz));
|
||||
|
||||
while(first != last) {
|
||||
|
||||
Reference in New Issue
Block a user