di 0.1.0
Loading...
Searching...
No Matches
cycle.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace di::container::view {
7namespace detail {
8 struct CycleFunction;
9
10 template<typename Con>
11 concept CustomCycle = concepts::TagInvocable<CycleFunction, Con>;
12
13 template<typename Con>
14 concept ViewCycle = requires(Con&& container) { CycleView { util::forward<Con>(container) }; };
15
16 struct CycleFunction : function::pipeline::EnablePipeline {
17 template<concepts::ViewableContainer Con>
18 requires(CustomCycle<Con> || ViewCycle<Con>)
19 constexpr auto operator()(Con&& container) const -> concepts::View auto {
20 if constexpr (CustomCycle<Con>) {
21 return function::tag_invoke(*this, util::forward<Con>(container));
22 } else {
23 return CycleView { util::forward<Con>(container) };
24 }
25 }
26 };
27
28}
29
30constexpr inline auto cycle = detail::CycleFunction {};
31}
32
33namespace di {
34using view::cycle;
35}
Definition adjacent.h:8
constexpr auto cycle
Definition cycle.h:30
CycleView(Con &&) -> CycleView< meta::AsView< Con > >
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
Definition any_storable.h:9