15 #ifndef OPENSCENARIO_INTERPRETER__FUNCTIONAL__FOLD_HPP_
16 #define OPENSCENARIO_INTERPRETER__FUNCTIONAL__FOLD_HPP_
23 inline namespace functional
25 template <
typename F,
typename T>
28 return std::forward<decltype(x)>(x);
31 template <
typename F,
typename T,
typename U,
typename... Ts>
32 constexpr decltype(
auto)
fold_left(F && f, T && x, U && y, Ts &&...
xs)
35 f, f(std::forward<decltype(x)>(x), std::forward<decltype(y)>(y)),
36 std::forward<decltype(
xs)>(
xs)...);
39 template <
typename F,
typename T>
42 return std::forward<decltype(x)>(x);
45 template <
typename F,
typename T,
typename... Ts>
48 return f(std::forward<decltype(x)>(x),
fold_right(f, std::forward<decltype(
xs)>(
xs)...));
51 template <
typename... Ts>
52 constexpr
auto fold(Ts &&...
xs) -> decltype(
auto)
constexpr decltype(auto) fold_left(F &&, T &&x)
Definition: fold.hpp:26
constexpr decltype(auto) fold_right(F &&, T &&x)
Definition: fold.hpp:40
constexpr auto fold(Ts &&... xs) -> decltype(auto)
Definition: fold.hpp:52
Definition: junit5.hpp:25