Skip to content

Commit

Permalink
Simplify container
Browse files Browse the repository at this point in the history
  • Loading branch information
gracicot committed Oct 24, 2024
1 parent 7c86715 commit d44acf2
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions include/kangaru/detail/container.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,19 @@ namespace kangaru {
template<typename Self>
using rebound_source_tree_t = decltype(std::declval<Self>().rebound_source_tree());

template<typename T>
static constexpr auto do_provide(auto&& source) -> T {
return kangaru::provide(
provide_tag_v<T>, KANGARU5_FWD(source).rebound_source_tree()
);
}

public:
template<typename T>
constexpr auto provide() & -> T requires source_of<rebound_source_tree_t<dynamic_container&>, T> {
return do_provide<T>(*this);
return kangaru::provide(
provide_tag_v<T>, rebound_source_tree()
);
}

template<typename T>
constexpr auto provide() && -> T requires source_of<rebound_source_tree_t<dynamic_container&&>, T> {
return do_provide<T>(std::move(*this));
return kangaru::provide(
provide_tag_v<T>, std::move(*this).rebound_source_tree()
);
}
};
}
Expand Down

0 comments on commit d44acf2

Please sign in to comment.