Skip to content

Commit

Permalink
Re-add read_only_adaptor::move_at specialisation
Browse files Browse the repository at this point in the history
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<T&>`.

Fixes #117
  • Loading branch information
tcbrindle committed Aug 10, 2023
1 parent c10ed6b commit c73be3d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions include/flux/op/read_only.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,25 @@ struct read_only_adaptor : map_adaptor<Base, cast_to_const<const_element_t<Base>
{}

struct flux_sequence_traits : map::flux_sequence_traits {
private:
using const_rvalue_element_t = std::common_reference_t<
value_t<Base> const&&, rvalue_element_t<Base>>;

public:
using value_type = value_t<Base>;

static constexpr auto move_at(auto& self, cursor_t<Base> const& cur)
-> const_rvalue_element_t
{
return static_cast<const_rvalue_element_t>(flux::move_at(self.base(), cur));
}

static constexpr auto move_at_unchecked(auto& self, cursor_t<Base> const& cur)
-> const_rvalue_element_t
{
return static_cast<const_rvalue_element_t>(flux::move_at_unchecked(self.base(), cur));
}

static constexpr auto data(auto& self)
requires contiguous_sequence<Base>
{
Expand Down

0 comments on commit c73be3d

Please sign in to comment.