*: cleanup

This commit is contained in:
Michele Caini
2020-12-23 19:09:31 +01:00
parent 2abcbcd30f
commit 2e5a9f117c
6 changed files with 29 additions and 29 deletions

View File

@@ -361,10 +361,10 @@ public:
/**
* @brief Returns the head of the list of destroyed entities.
*
*
* This function is intended for use in conjunction with `assign`.<br/>
* The returned entity has an invalid identifier in all cases.
*
*
* @return The head of the list of destroyed entities.
*/
[[nodiscard]] entity_type destroyed() const ENTT_NOEXCEPT {

View File

@@ -526,7 +526,7 @@ public:
/**
* @brief Sort all elements according to the given comparison function.
*
*
* @sa sort_n
*
* @tparam Compare Type of comparison function object.

View File

@@ -175,11 +175,11 @@ TEST(BasicHandle, Component) {
ASSERT_TRUE(registry.empty<int>());
ASSERT_TRUE(handle.orphan());
ASSERT_EQ(42, handle.get_or_emplace<int>(42));
ASSERT_EQ(42, handle.get_or_emplace<int>(1));
ASSERT_EQ(42, handle.get<int>());
ASSERT_EQ(42, *handle.try_get<int>());
ASSERT_EQ(nullptr, handle.try_get<char>());
ASSERT_EQ(nullptr, std::get<1>(handle.try_get<int, char, double>()));

View File

@@ -875,4 +875,4 @@ TEST(MultiComponentView, DeductionGuide) {
static_assert(std::is_same_v<decltype(entt::basic_view{std::as_const(istorage), dstorage}), entt::basic_view<entt::entity, entt::exclude_t<>, const int, double>>);
static_assert(std::is_same_v<decltype(entt::basic_view{istorage, std::as_const(dstorage)}), entt::basic_view<entt::entity, entt::exclude_t<>, int, const double>>);
static_assert(std::is_same_v<decltype(entt::basic_view{std::as_const(istorage), std::as_const(dstorage)}), entt::basic_view<entt::entity, entt::exclude_t<>, const int, const double>>);
}
}

View File

@@ -5,39 +5,39 @@
#include <entt/meta/resolve.hpp>
struct clazz_t {
void incr() { ++value; }
void decr() { --value; }
int value;
void incr() { ++value; }
void decr() { --value; }
int value;
};
struct MetaHandle: ::testing::Test {
static void SetUpTestCase() {
using namespace entt::literals;
static void SetUpTestCase() {
using namespace entt::literals;
entt::meta<clazz_t>()
.func<&clazz_t::incr>("incr"_hs)
.func<&clazz_t::decr>("decr"_hs);
}
entt::meta<clazz_t>()
.func<&clazz_t::incr>("incr"_hs)
.func<&clazz_t::decr>("decr"_hs);
}
};
TEST_F(MetaHandle, Functionalities) {
using namespace entt::literals;
using namespace entt::literals;
clazz_t instance{};
entt::meta_handle handle{};
clazz_t instance{};
entt::meta_handle handle{};
ASSERT_FALSE(*handle);
ASSERT_FALSE(*handle);
handle = entt::meta_handle{instance};
handle = entt::meta_handle{instance};
ASSERT_TRUE(*handle);
ASSERT_TRUE((*handle).invoke("incr"_hs));
ASSERT_EQ(instance.value, 1);
ASSERT_TRUE(*handle);
ASSERT_TRUE((*handle).invoke("incr"_hs));
ASSERT_EQ(instance.value, 1);
entt::meta_any any{std::ref(instance)};
handle = entt::meta_handle{any};
entt::meta_any any{std::ref(instance)};
handle = entt::meta_handle{any};
ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
ASSERT_TRUE(handle->invoke("decr"_hs));
ASSERT_EQ(instance.value, 0);
ASSERT_FALSE(std::as_const(handle)->invoke("decr"_hs));
ASSERT_TRUE(handle->invoke("decr"_hs));
ASSERT_EQ(instance.value, 0);
}

View File

@@ -9,7 +9,7 @@
template<typename Type>
struct wrapped_shared_ptr {
wrapped_shared_ptr(Type init): ptr{new Type {init}} {}
Type & deref() const { return *ptr; }
private: