From 83bca7d6861a701e8ba383a93076f346db393a33 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 24 Feb 2023 08:59:46 +0100 Subject: a --- entity/constraints.hpp | 5 +++++ entity/metadata.hpp | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'entity') diff --git a/entity/constraints.hpp b/entity/constraints.hpp index cfe33bfe..b4989353 100644 --- a/entity/constraints.hpp +++ b/entity/constraints.hpp @@ -35,6 +35,11 @@ constexpr range::operator erased_constraints::range() const noexcept template constexpr range::operator std::pair() const noexcept { return { min, max }; } +template<> struct range +{ + constexpr operator erased_constraints::range() const noexcept { return {}; } +}; + using max_length = erased_constraints::max_length; using group = erased_constraints::group; diff --git a/entity/metadata.hpp b/entity/metadata.hpp index b373a927..e2d9eb67 100644 --- a/entity/metadata.hpp +++ b/entity/metadata.hpp @@ -123,9 +123,9 @@ public: fm_DECLARE_DEFAULT_MOVE_COPY_ASSIGNMENTS(entity_field); static constexpr decltype(auto) read(const R& reader, const Obj& x) { return detail::read_field::read(x, reader); } - static constexpr void write(const W& writer, Obj& x, move_qualified v); + static constexpr void write(const W& writer, Obj& x, Type v); constexpr decltype(auto) read(const Obj& x) const { return read(reader, x); } - constexpr void write(Obj& x, move_qualified value) const { write(writer, x, value); } + constexpr void write(Obj& x, Type value) const { write(writer, x, std::move(value)); } static constexpr bool can_write = !std::is_same_v::writer)>; static constexpr field_status is_enabled(const Predicate & p, const Obj& x); @@ -149,9 +149,9 @@ public: }; template R, FieldWriter W, typename... Ts> -constexpr void entity_field::write(const W& writer, Obj& x, move_qualified v) +constexpr void entity_field::write(const W& writer, Obj& x, Type v) { - static_assert(can_write); detail::write_field::write(x, writer, v); + static_assert(can_write); detail::write_field::write(x, writer, std::move(v)); } template R, FieldWriter W, typename... Ts> @@ -174,8 +174,8 @@ constexpr erased_accessor entity_field::erased() const constexpr auto writer_fn = [](void* obj, const writer_t* writer, void* value) { auto& obj_ = *reinterpret_cast(obj); const auto& writer_ = *reinterpret_cast(writer); - move_qualified value_ = std::move(*reinterpret_cast(value)); - write(writer_, obj_, value_); + Type value_ = std::move(*reinterpret_cast(value)); + write(writer_, obj_, std::move(value_)); }; constexpr auto predicate_fn = [](const void* obj, const predicate_t* predicate) { const auto& obj_ = *reinterpret_cast(obj); -- cgit v1.2.3