diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-19 13:01:26 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-11-19 13:03:39 +0100 |
commit | 8cbc8962ea1bcb57ef2b5d1baee78b03c2ace669 (patch) | |
tree | d747513a2945d232f88cccd6cb69cd4417bbf07c | |
parent | d1c04ea956d40ba3ccc4977b7427c1f4acae8597 (diff) |
entity: fix whitespace & msvc warnings
-rw-r--r-- | entity/metadata.hpp | 8 | ||||
-rw-r--r-- | test/entity.cpp | 26 |
2 files changed, 17 insertions, 17 deletions
diff --git a/entity/metadata.hpp b/entity/metadata.hpp index d1ecfa71..2aae47f9 100644 --- a/entity/metadata.hpp +++ b/entity/metadata.hpp @@ -5,6 +5,7 @@ #include "util.hpp" #include "concepts.hpp" #include <cstddef> +#include <concepts> #include <type_traits> #include <limits> #include <utility> @@ -13,9 +14,7 @@ #include <compat/function2.hpp> #include <Corrade/Containers/StringView.h> -namespace floormat::entities { - -namespace detail { +namespace floormat::entities::detail { template<typename F, typename Tuple, std::size_t N> requires std::invocable<F, decltype(std::get<N>(std::declval<Tuple>()))> @@ -75,8 +74,9 @@ constexpr std::size_t find_reader_index = find_reader_<Obj, Type, Default, 0, st template<typename Obj, auto constant> constexpr auto constantly = [](const Obj&) constexpr { return constant; }; +} // namespace floormat::entities::detail -} // namespace detail +namespace floormat::entities { template<typename Obj, typename Type> struct entity_field_base {}; diff --git a/test/entity.cpp b/test/entity.cpp index ea9e928f..ec22f3fc 100644 --- a/test/entity.cpp +++ b/test/entity.cpp @@ -148,9 +148,9 @@ void test_type_name() constexpr bool test_null_writer() { - constexpr auto m_foo = entity::type<int>::field{"foo"_s, &TestAccessors::foo, nullptr}; - static_assert(m_foo.writer == nullptr); - static_assert(!m_foo.can_write); + constexpr auto foo = entity::type<int>::field{"foo"_s, &TestAccessors::foo, nullptr}; + static_assert(foo.writer == nullptr); + static_assert(!foo.can_write); static_assert(std::get<0>(TestAccessors::accessors()).can_write); return true; } @@ -158,17 +158,17 @@ constexpr bool test_null_writer() void test_predicate() { constexpr TestAccessors x{0, 0, 0}; - constexpr auto m_foo = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo, - [](const TestAccessors&) { return field_status::hidden; }}; - static_assert(m_foo.is_enabled(m_foo.predicate, x) == field_status::hidden); - fm_assert(m_foo.erased().is_enabled(x) == field_status::hidden); - constexpr auto m_foo2 = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo, + constexpr auto foo = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo, + [](const TestAccessors&) { return field_status::hidden; }}; + static_assert(foo.is_enabled(foo.predicate, x) == field_status::hidden); + fm_assert(foo.erased().is_enabled(x) == field_status::hidden); + constexpr auto foo2 = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo, [](const TestAccessors&) { return field_status::readonly; }}; - static_assert(m_foo2.is_enabled(m_foo2.predicate, x) == field_status::readonly); - fm_assert(m_foo2.erased().is_enabled(x) == field_status::readonly); - constexpr auto m_foo3 = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo}; - static_assert(m_foo3.is_enabled(m_foo3.predicate, x) == field_status::enabled); - fm_assert(m_foo3.erased().is_enabled(x) == field_status::enabled); + static_assert(foo2.is_enabled(foo2.predicate, x) == field_status::readonly); + fm_assert(foo2.erased().is_enabled(x) == field_status::readonly); + constexpr auto foo3 = entity::type<int>::field{"foo"_s, &TestAccessors::foo, &TestAccessors::foo}; + static_assert(foo3.is_enabled(foo3.predicate, x) == field_status::enabled); + fm_assert(foo3.erased().is_enabled(x) == field_status::enabled); } constexpr bool test_names() |