Iros
 
Loading...
Searching...
No Matches
reconstruct.h
Go to the documentation of this file.
1#pragma once
2
8#include "di/meta/core.h"
9#include "di/meta/language.h"
10#include "di/meta/util.h"
11#include "di/util/forward.h"
12
13namespace di::container {
15
16namespace detail {
17 template<typename... Args>
19
20 template<typename It, typename Sent>
23};
24
26 template<typename It, typename Sent>
29 constexpr auto operator()(It&& iterator, Sent&& sentinel) const -> concepts::View auto {
31 return function::tag_invoke(*this, util::forward<It>(iterator), util::forward<Sent>(sentinel));
32 } else {
33 return View<meta::RemoveCVRef<It>, meta::RemoveCVRef<Sent>>(util::forward<It>(iterator),
34 util::forward<Sent>(sentinel));
35 }
36 }
37
38 template<concepts::Container Con, typename It, typename Sent>
39 constexpr auto operator()(InPlaceType<Con>, It&& iterator, Sent&& sentinel) const -> concepts::View auto
41 requires {
42 { (*this)(util::forward<It>(iterator), util::forward<Sent>(sentinel)) } -> concepts::View;
44 {
45 if constexpr (detail::CustomReconstruct<InPlaceType<Con>, It, Sent>) {
46 return function::tag_invoke(*this, in_place_type<Con>, util::forward<It>(iterator),
47 util::forward<Sent>(sentinel));
48 } else if constexpr (detail::ViewReconstruct<It, Sent>) {
49 return View<meta::RemoveCVRef<It>, meta::RemoveCVRef<Sent>>(util::forward<It>(iterator),
50 util::forward<Sent>(sentinel));
51 } else {
52 return (*this)(util::forward<It>(iterator), util::forward<Sent>(sentinel));
53 }
54 }
55
56 template<concepts::Container Con, concepts::Container T, typename It, typename Sent>
57 constexpr auto operator()(InPlaceType<Con>, T&& container, It&& iterator, Sent&& sentinel) const -> concepts::View
58 auto
59 requires(detail::CustomReconstruct<InPlaceType<Con>, T, It, Sent> ||
60 requires {
61 {
62 (*this)(in_place_type<Con>, util::forward<It>(iterator), util::forward<Sent>(sentinel))
63 } -> concepts::View;
64 })
65 {
66 if constexpr (detail::CustomReconstruct<InPlaceType<Con>, Con, It, Sent>) {
67 return function::tag_invoke(*this, in_place_type<Con>, util::forward<T>(container),
68 util::forward<It>(iterator), util::forward<Sent>(sentinel));
69 } else {
70 return (*this)(in_place_type<Con>, util::forward<It>(iterator), util::forward<Sent>(sentinel));
71 }
72 }
73};
74
75constexpr inline auto reconstruct = ReconstructFunction {};
76}
77
78namespace di {
80}
Definition view.h:35
Definition language.h:253
Definition operations.h:11
Definition language.h:259
Definition tag_invoke.h:33
Definition view.h:10
Definition reconstruct.h:18
Definition reconstruct.h:21
Definition sequence.h:13
Definition sequence.h:12
constexpr auto reconstruct
Definition reconstruct.h:75
constexpr tag_invoke_detail::TagInvokeFn tag_invoke
Definition tag_invoke.h:22
RemoveCV< RemoveReference< T > > RemoveCVRef
Definition core.h:74
Definition zstring_parser.h:9
constexpr auto in_place_type
Definition in_place_type.h:12
@ T
Definition key.h:29
Definition reconstruct.h:25
constexpr auto operator()(InPlaceType< Con >, It &&iterator, Sent &&sentinel) const -> concepts::View auto requires(detail::CustomReconstruct< InPlaceType< Con >, It, Sent >||
Definition reconstruct.h:39
constexpr auto operator()(It &&iterator, Sent &&sentinel) const -> concepts::View auto
Definition reconstruct.h:29
Definition in_place_type.h:5