From 12a294af7183e470f9eb4fd7b1c5039ee65eed7e Mon Sep 17 00:00:00 2001 From: Patrick Urbanke Date: Sun, 31 Mar 2024 11:42:20 +0200 Subject: [PATCH] Allow writing from pointers --- include/rfl/internal/to_ptr_field.hpp | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/include/rfl/internal/to_ptr_field.hpp b/include/rfl/internal/to_ptr_field.hpp index 38249dad..0db97cc3 100644 --- a/include/rfl/internal/to_ptr_field.hpp +++ b/include/rfl/internal/to_ptr_field.hpp @@ -13,39 +13,18 @@ namespace internal { template inline auto to_ptr_field(Field<_name, Type>& _field) { - if constexpr (std::is_pointer_v) { - static_assert(always_false_v, - "Writing from raw pointers is dangerous and " - "therefore unsupported. " - "Please consider using std::unique_ptr, rfl::Box, " - "std::shared_ptr, rfl::Ref or std::optional instead."); - } using T = std::remove_reference_t; return Field<_name, T*>(&_field.value_); } template inline auto to_ptr_field(const Field<_name, Type>& _field) { - if constexpr (std::is_pointer_v) { - static_assert(always_false_v, - "Writing from raw pointers is dangerous and " - "therefore unsupported. " - "Please consider using std::unique_ptr, rfl::Box, " - "std::shared_ptr, rfl::Ref or std::optional instead."); - } using T = std::remove_cvref_t; return Field<_name, const T*>(&_field.value_); } template inline auto to_ptr_field(Flatten& _field) { - if constexpr (std::is_pointer_v) { - static_assert(always_false_v, - "Writing from raw pointers is dangerous and " - "therefore unsupported. " - "Please consider using std::unique_ptr, rfl::Box, " - "std::shared_ptr, rfl::Ref or std::optional instead."); - } using T = std::remove_reference_t; return Flatten(&_field.value_); }