Spec-Zone.ru › C++

indirectly-binary-left-foldable, indirectly-binary-right-foldable

template< class F, class T, class I >
concept /*indirectly-binary-left-foldable*/ =
    std::copy_constructible<F> &&
    std::indirectly_readable<I> &&
    std::invocable<F&, T, std::iter_reference_t<I>> &&
    std::convertible_to<std::invoke_result_t
        <F&, T, std::iter_reference_t<I>>,
         std::decay_t<std::invoke_result_t<F&, T, std::iter_reference_t<I>>>> &&
    /*indirectly-binary-left-foldable-impl*/
        <F, T, I,
         std::decay_t<std::invoke_result_t<F&, T, std::iter_reference_t<I>>>>;
(1) (since C++23)
(exposition only*)
template< class F, class T, class I >
concept /*indirectly-binary-right-foldable*/ =
    /*indirectly-binary-left-foldable*/</*flipped*/<F>, T, I>;
(2) (since C++23)
(exposition only*)
Helper concepts
template< class F, class T, class I, class U >
concept /*indirectly-binary-left-foldable-impl*/ =
    std::movable<T> &&
    std::movable<U> &&
    std::convertible_to<T, U> &&
    std::invocable<F&, U, std::iter_reference_t<I>> &&
    std::assignable_from
        <U&, std::invoke_result_t<F&, U, std::iter_reference_t<I>>>;
(3) (since C++23)
(exposition only*)
template< class F >
class /*flipped*/
{
    F f;    // exposition only
public:
    template< class T, class U >
        requires std::invocable<F&, U, T>
    std::invoke_result_t<F&, U, T> operator()( T&&, U&& );
};
(4) (since C++23)
(exposition only*)
1) The exposition-only concept indirectly-binary-left-foldable is used by left-folding algorithms to constrain the function object template parameter.
2) The exposition-only concept indirectly-binary-right-foldable is used by right-folding algorithms to constrain the function object template parameter.

See also

ranges::fold_left
(C++23)
left-folds a range of elements
(algorithm function object)
ranges::fold_left_with_iter
(C++23)
left-folds a range of elements, and returns a pair (iterator, value)
(algorithm function object)
ranges::fold_left_first
(C++23)
left-folds a range of elements using the first element as an initial value
(algorithm function object)
ranges::fold_left_first_with_iter
(C++23)
left-folds a range of elements using the first element as an initial value, and returns a pair (iterator, optional)
(algorithm function object)
ranges::fold_right
(C++23)
right-folds a range of elements
(algorithm function object)
ranges::fold_right_last
(C++23)
right-folds a range of elements using the last element as an initial value
(algorithm function object)

© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/algorithm/ranges/fold_concepts

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API