From 9c9132225c96db6779712a7e6d5162815a676052 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 19 Nov 2022 17:54:51 +0100 Subject: entity: make constantly() even more evil --- entity/metadata.hpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'entity/metadata.hpp') diff --git a/entity/metadata.hpp b/entity/metadata.hpp index 1067a006..935f1792 100644 --- a/entity/metadata.hpp +++ b/entity/metadata.hpp @@ -70,17 +70,19 @@ struct find_reader { using type = F; static con namespace floormat::entities { -template constexpr auto constantly(const auto& x) noexcept { return [x](const Ts&...) constexpr { return x; }; } +constexpr auto constantly(const auto& x) noexcept { + return [x] (const Ts&...) constexpr -> const auto& { return x; }; +} template struct entity_field_base {}; template R, FieldWriter W, typename... Ts> struct entity_field : entity_field_base { private: - static constexpr auto default_predicate = constantly(field_status::enabled); - static constexpr auto default_c_range = constantly(constraints::range{}); - static constexpr auto default_c_length = constantly(constraints::max_length{std::size_t(-1)}); - static constexpr auto default_c_group = constantly(StringView{}); + static constexpr auto default_predicate = constantly(field_status::enabled); + static constexpr auto default_c_range = constantly(constraints::range{}); + static constexpr auto default_c_length = constantly(constraints::max_length{std::size_t(-1)}); + static constexpr auto default_c_group = constantly(StringView{}); using default_predicate_t = std::decay_t; using default_c_range_t = std::decay_t; using default_c_length_t = std::decay_t; -- cgit v1.2.3