fixed constness
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
#include "../config/config.h"
|
||||
#include "registry.hpp"
|
||||
#include "entity.hpp"
|
||||
@@ -126,7 +127,7 @@ struct actor {
|
||||
*/
|
||||
template<typename... Component>
|
||||
decltype(auto) get() const ENTT_NOEXCEPT {
|
||||
return reg->template get<Component...>(entt);
|
||||
return std::as_const(*reg).template get<Component...>(entt);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,7 +147,7 @@ struct actor {
|
||||
*/
|
||||
template<typename... Component>
|
||||
auto get_if() const ENTT_NOEXCEPT {
|
||||
return reg->template get_if<Component...>(entt);
|
||||
return std::as_const(*reg).template get_if<Component...>(entt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -184,8 +184,7 @@ public:
|
||||
template<typename... Component>
|
||||
decltype(auto) get() const ENTT_NOEXCEPT {
|
||||
if constexpr(sizeof...(Component) == 1) {
|
||||
const auto &component = reg->template get<component_wrapper<Component...>>(entity).component;
|
||||
return component;
|
||||
return (std::as_const(*reg).template get<component_wrapper<Component...>>(entity).component);
|
||||
} else {
|
||||
return std::tuple<const Component &...>{get<Component>()...};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user