13 template <
typename F,
typename Ret,
typename A,
typename... Rest>
14 A helper(Ret (
F::*)(
A, Rest...));
16 template <
typename F,
typename Ret,
typename A,
typename... Rest>
17 A helper(Ret (
F::*)(
A, Rest...)
const);
21 template <
typename FuncT>
24 using type = decltype(helper(&FuncT::operator()));
27 template <
typename FuncT>
28 using first_argument_t =
typename first_argument<FuncT>::type;
37 template <
class FunctionT,
class ChildT>
39 call(FunctionT&& func, ChildT&& child)
41 if constexpr (std::is_same_v<decltype(func(child)),
bool>)
57 template <
class ContainerT,
class FunctionT>
61 for (
auto& child : container)
63 if (not
call(func, child))
72 template <
class ContainerT,
class FunctionT>
76 for (
auto& [_, child] : container)
78 if (not
call(func, child))
89 template <
class,
class =
void>
100 template <
class ContainerT,
class FunctionT>
114 template <
class FunctionT,
class ParentT,
class ChildT>
122 auto childFn = [&id, &func](
auto& child) {
return child.forEachInstanceIn(
id, func); };
125 return child ? childFn(*child) :
true;
129 return parent.forEachChild(childFn);
136 template <
class DerivedT>
144 template <
class InstanceFunctionT>
148 return derived<DerivedT>(
this).forEachSnapshot(
149 [&func](
auto& snapshot) ->
bool {
return snapshot.forEachInstance(func); });
155 template <
class InstanceFunctionT>
159 return derived<DerivedT>(
this).forEachSnapshot(
160 [&func](
const auto& snapshot) ->
bool {
return snapshot.forEachInstance(func); });
177 template <
class AronDtoFunctionT>
181 using AronDtoT =
typename std::remove_const_t<
182 std::remove_reference_t<first_argument_t<AronDtoFunctionT>>>;
184 return derived<DerivedT>(
this).forEachInstance(
185 [&func](
const auto& instance)
186 {
return func(instance.template dataAs<AronDtoT>()); });
211 template <
class EntityInstanceBaseAronDtoFunctionT>
215 using AronDtoT =
typename std::remove_reference_t<
216 first_argument_t<EntityInstanceBaseAronDtoFunctionT>>::DataT;
218 return derived<DerivedT>(
this).forEachInstance(
219 [&func](
const auto& instance)
220 {
return func(instance.template withDataAs<AronDtoT>()); });
224 template <
class DerivedT>
230 template <
class SnapshotFunctionT>
234 return derived<DerivedT>(
this).forEachEntity([&func](
auto& entity) ->
bool
235 {
return entity.forEachSnapshot(func); });
241 template <
class SnapshotFunctionT>
245 return derived<DerivedT>(
this).forEachEntity([&func](
const auto& entity) ->
bool
246 {
return entity.forEachSnapshot(func); });
250 template <
class DerivedT>
256 template <
class FunctionT>
260 return derived<DerivedT>(
this).forEachProviderSegment(
261 [&func](
auto& providerSegment) ->
bool
262 {
return providerSegment.forEachEntity(func); });
268 template <
class FunctionT>
272 return derived<DerivedT>(
this).forEachProviderSegment(
273 [&func](
const auto& providerSegment) ->
bool
274 {
return providerSegment.forEachEntity(func); });
278 template <
class DerivedT>
284 template <
class FunctionT>
288 return derived<DerivedT>(
this).forEachCoreSegment(
289 [&func](
auto& coreSegment) ->
bool
290 {
return coreSegment.forEachProviderSegment(func); });
296 template <
class FunctionT>
300 return derived<DerivedT>(
this).forEachCoreSegment(
301 [&func](
const auto& coreSegment) ->
bool
302 {
return coreSegment.forEachProviderSegment(func); });