5 #ifndef VCCC_ALGORITHM_RANGES_FOLD_LEFT_HPP
6 #define VCCC_ALGORITHM_RANGES_FOLD_LEFT_HPP
34 template<
typename F,
typename T,
typename I,
typename U,
39 invocable<F&, U, iter_reference_t<I>>
41 struct indirectly_binary_left_foldable_impl
42 : assignable_from<U&, invoke_result_t<F&, U, iter_reference_t<I>>> {};
43 template<
typename F,
typename T,
typename I,
typename U>
44 struct indirectly_binary_left_foldable_impl<F, T, I, U, false> : std::false_type {};
46 template<
typename F,
typename T,
typename I,
47 bool = invocable<F&, T, iter_reference_t<I>>
::value >
48 struct indirectly_binary_left_foldable_2
51 invoke_result_t<F&, T, iter_reference_t<I>>,
52 std::decay_t<invoke_result_t<F&, T, iter_reference_t<I>>>>,
53 indirectly_binary_left_foldable_impl<F, T, I, std::decay_t<invoke_result_t<F&, T, iter_reference_t<I>>>>
55 template<
typename F,
typename T,
typename I>
56 struct indirectly_binary_left_foldable_2<F, T, I, false> : std::false_type {};
58 template<
typename F,
typename T,
typename I,
60 copy_constructible<F>,
61 indirectly_readable<I>,
62 has_typename_type<iter_reference<I>>
64 struct indirectly_binary_left_foldable : indirectly_binary_left_foldable_2<F, T, I> {};
65 template<
typename F,
typename T,
typename I>
66 struct indirectly_binary_left_foldable<F, T, I, false> : std::false_type {};
68 struct fold_left_niebloid {
71 struct check_range : std::false_type {};
72 template<
typename R,
typename T,
typename F>
73 struct check_range<R, T, F, true>
74 : indirectly_binary_left_foldable<F, T, iterator_t<R>> {};
77 template<
typename I,
typename S,
typename T,
typename F, std::enable_if_t<conjunction<
80 indirectly_binary_left_foldable<F, T, I>
82 constexpr
auto operator()(I
first, S last, T init, F f)
const {
83 using U = std::decay_t<invoke_result_t<F&, T, iter_reference_t<I>>>;
86 return U(std::move(init));
97 constexpr
auto operator()(R&& r, T init, F f)
const {
constexpr VCCC_INLINE_OR_STATIC detail::fold_left_niebloid fold_left
Definition: fold_left.hpp:107
constexpr invoke_result_t< F, Args... > invoke(F &&f, Args &&... args) noexcept(is_nothrow_invocable< F, Args... >::value)
Definition: invoke.hpp:38
constexpr VCCC_INLINE_OR_STATIC detail::begin_niebloid begin
returns an iterator to the beginning of a range
Definition: begin.hpp:116
constexpr VCCC_INLINE_OR_STATIC detail::end_niebloid end
returns a sentinel indicating the end of a range
Definition: end.hpp:120
#define VCCC_INLINE_OR_STATIC
Definition: inline_or_static.hpp:9
Definition: directory.h:12
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 0 > first
Definition: key_value.hpp:34
constexpr VCCC_INLINE_OR_STATIC detail::element_niebloid< 1 > value
Definition: key_value.hpp:35