Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
indirect_result_t.hpp
Go to the documentation of this file.
1// parasoft-begin-suppress CERT_C-EXP37-a-3 "False positive: The rule does not mention naming all parameters"
2// Copyright 2026, Toyota Motor Corporation
3//
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_INDIRECT_RESULT_T_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_INDIRECT_RESULT_T_HPP_
7
8// IWYU pragma: private, include "arene/base/iterator.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
14#include "arene/base/stdlib_choice/enable_if.hpp"
16
17namespace arene {
18namespace base {
19namespace indirect_result_detail {
20// parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: cannot apply static here"
21/// @brief A deduction helper which ensures that all iterator types are indirectly readable and that the callable F is
22/// invocable with the references obtained from them.
23/// @tparam F The callable type.
24/// @tparam Is The indirectly readable iterator types.
25/// @return The result type of invoking F with the references obtained from the indirectly readable iterators.
26/// @note Doing constraints via a constrained function overload like this results in clear compiler errors for
27/// violations of the constraints.
28template <typename F, typename... Is>
29constexpr auto require_indirect_result(
33// parasoft-end-suppress AUTOSAR-M3_3_2-a
34} // namespace indirect_result_detail
35
36/// @brief Determines the result type of invoking a callable F with the references obtained from indirectly readable
37/// iterators Is...
38/// @tparam F The callable type.
39/// @tparam Is The indirectly readable iterator types.
40/// If all types in @c Is... satisfy @c is_indirectly_readable and @c is_invocable_v<F,iter_reference_t<Is>...> is
41/// satisfied, then will be equivalent to @c invoke_result_t<F,iter_reference_t<Is>...> , otherwise will be ill-formed
42/// in a manner that will cause substitution failure if evaluated in a SFINAE context.
43template <class F, class... Is>
44using indirect_result_t = decltype(indirect_result_detail::require_indirect_result<F, Is...>());
45} // namespace base
46} // namespace arene
47
48#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_INDIRECT_RESULT_T_HPP_
Definition accumulate.hpp:37
constexpr bool is_invocable_v
Determine if a functor type is invocable with the specified argument types.
typename invoke_result< Fn, Args... >::type invoke_result_t
The return type of a functor invoked with the specified arguments.
Definition is_invocable.hpp:271
constexpr bool is_indirectly_readable_v
Query trait to determine if an iterator is indirectly readable. A backport of the [std::indirectly_re...
Is... >()) indirect_result_t
Determines the result type of invoking a callable F with the references obtained from indirectly read...
Definition indirect_result_t.hpp:44
typename iter_reference_detail::iter_reference_impl< Itr >::type iter_reference_t
Determins the reference type of the given iterator.
Definition iter_reference_t.hpp:47
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41