Skip to content

Commit

Permalink
Remove operator overload
Browse files Browse the repository at this point in the history
Signed-off-by: Nahuel Espinosa <nespinosa@ekumenlabs.com>
  • Loading branch information
nahueespinosa committed Jan 13, 2024
1 parent 905fcd0 commit 1c5eefd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
24 changes: 0 additions & 24 deletions beluga/include/beluga/actions/assign.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,6 @@ struct assign_fn {
*/
inline constexpr detail::assign_fn assign;

/// Operator overload that appends assign to any range closure.
template <
class Range,
class Fn,
std::enable_if_t<ranges::range<Range>, int> = 0,
std::enable_if_t<is_range_closure_v<Fn>, int> = 0>
constexpr auto operator<<=(Range& range, Fn fn) -> Range& {
return range |= std::move(fn) | beluga::actions::assign;
}

} // namespace beluga::actions

// Make the assign operator overload findable by ADL for existing range adaptor objects:

namespace beluga::views {
using beluga::actions::operator<<=;
}

namespace ranges::views {
using beluga::actions::operator<<=;
}

namespace ranges::actions {
using beluga::actions::operator<<=;
}

#endif
8 changes: 1 addition & 7 deletions beluga/test/beluga/actions/test_assign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ TEST(AssignAction, ViewToActionCall) {
ASSERT_TRUE(ranges::equal(input, std::vector{3, 2, 1}));
}

TEST(AssignAction, ViewToActionOperator) {
auto input = std::vector{1, 2, 3};
input <<= ranges::views::reverse;
ASSERT_TRUE(ranges::equal(input, std::vector{3, 2, 1}));
}

TEST(AssignAction, ActionComposition) {
auto input = std::vector{1, 2, 3};
input |= ranges::actions::drop(1) | beluga::actions::assign;
Expand All @@ -90,7 +84,7 @@ TEST(AssignAction, ActionViewActionComposition) {

TEST(AssignAction, List) {
auto input = std::list{1, 2, 3};
input <<= ranges::actions::remove(2) | ranges::views::reverse;
input |= ranges::actions::remove(2) | ranges::views::reverse | beluga::actions::assign;
ASSERT_TRUE(ranges::equal(input, std::list{3, 1}));
}

Expand Down

0 comments on commit 1c5eefd

Please sign in to comment.