@@ -639,6 +639,13 @@ constexpr void template_for(F&& f)
639639 }(std::make_integer_sequence<t, E - B> {});
640640}
641641
642+ // / Folds over the members of a type
643+ // /
644+ // / @param initialValue The initial value to fold with
645+ // / @param callable The callable to fold with. The parameters are the member name,
646+ // / the member's default value and the current result of the fold.
647+ // /
648+ // / @return The result of the fold
642649template <typename Object, typename Callable, typename ResultType>
643650constexpr ResultType FoldType (ResultType initialValue, Callable const & callable)
644651{
@@ -712,6 +719,14 @@ void CallOnMembers(Object& object, Callable&& callable)
712719 [&]<auto I>() { callable (Reflection::MemberNameOf<I, Object>, std::get<I>(Reflection::ToTuple (object))); });
713720}
714721
722+ // / Folds over the members of an object
723+ // /
724+ // / @param object The object to fold over
725+ // / @param initialValue The initial value to fold with
726+ // / @param callable The callable to fold with. The parameters are the member name,
727+ // / the member value and the current result of the fold.
728+ // /
729+ // / @return The result of the fold
715730template <typename Object, typename Callable, typename ResultType>
716731constexpr ResultType FoldMembers (Object const & object, ResultType initialValue, Callable const & callable)
717732{
0 commit comments