From c73be3d975e6ec26a4d6ebb4411086c363df9d25 Mon Sep 17 00:00:00 2001 From: Tristan Brindle Date: Thu, 10 Aug 2023 16:39:01 +0100 Subject: [PATCH] Re-add read_only_adaptor::move_at specialisation Since #97 this was falling back to `map_adaptor::move_at()`, which does the wrong thing in C++23 mode when the base element type is something like `tuple`. Fixes #117 --- include/flux/op/read_only.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/include/flux/op/read_only.hpp b/include/flux/op/read_only.hpp index 289665c3..349187f1 100644 --- a/include/flux/op/read_only.hpp +++ b/include/flux/op/read_only.hpp @@ -30,8 +30,25 @@ struct read_only_adaptor : map_adaptor {} struct flux_sequence_traits : map::flux_sequence_traits { + private: + using const_rvalue_element_t = std::common_reference_t< + value_t const&&, rvalue_element_t>; + + public: using value_type = value_t; + static constexpr auto move_at(auto& self, cursor_t const& cur) + -> const_rvalue_element_t + { + return static_cast(flux::move_at(self.base(), cur)); + } + + static constexpr auto move_at_unchecked(auto& self, cursor_t const& cur) + -> const_rvalue_element_t + { + return static_cast(flux::move_at_unchecked(self.base(), cur)); + } + static constexpr auto data(auto& self) requires contiguous_sequence {