Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
iter_const_reference_t.hpp
Go to the documentation of this file.
1// parasoft-begin-suppress AUTOSAR-A2_8_1-a-2 "False positive: also defines arene::base::iter_const_reference_t"
2// Copyright 2026, Toyota Motor Corporation
3//
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5
6#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_ITER_CONST_REFERENCE_T_HPP_
7#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_ITER_CONST_REFERENCE_T_HPP_
8
9// IWYU pragma: private, include "arene/base/iterator.hpp"
10// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
11
17#include "arene/base/stdlib_choice/enable_if.hpp"
18#include "arene/base/stdlib_choice/remove_cv.hpp"
19#include "arene/base/stdlib_choice/remove_reference.hpp"
21
22namespace arene {
23namespace base {
24
25namespace iter_const_reference_detail {
26
27/// @brief Helper class for computing the constant reference type of an indirectly readable type.
28/// @tparam Type The indirectly readable type for which to compute the constant reference type.
29/// @see iter_const_reference_t
30/// The primary template is malformed.
31template <typename Type, typename = constraints<>>
32class iter_const_reference_t;
33
34/// @brief Specialization of iter_const_reference_t for indirectly readable types.
35/// @tparam Type The indirectly readable type for which to compute the constant reference type.
36/// @see iter_const_reference_t
37template <typename Type>
38class iter_const_reference_t<Type, constraints<std::enable_if_t<is_indirectly_readable_v<Type>>>> {
39 public:
40 /// @brief The constant reference type for the indirectly readable type @c Type.
42};
43
44} // namespace iter_const_reference_detail
45
46/// @brief A backport of @c std::iter_const_reference_t. Computes the
47/// constant reference type for an indirectly readable type.
48/// @tparam Type The indirectly readable type for which to compute the constant reference type.
49///
50/// If @c Type satisfies @c is_indirectly_readable , then this will be <c>common_reference_t<iter_value_t<Type> const&&,
51/// iter_reference_t<Type>></c>. Otherwise, it will be ill-formed such that it would result in a specialization failure
52/// during template instantiation.
53template <typename Type>
54using iter_const_reference_t = typename iter_const_reference_detail::iter_const_reference_t<Type>::type;
55
56} // namespace base
57} // namespace arene
58
59#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ITERATOR_ITER_CONST_REFERENCE_T_HPP_
Definition accumulate.hpp:37
typename iter_const_reference_detail::iter_const_reference_t< Type >::type iter_const_reference_t
A backport of std::iter_const_reference_t. Computes the constant reference type for an indirectly rea...
Definition iter_const_reference_t.hpp:54
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
typename common_reference< Ts... >::type common_reference_t
Alias template to extract the common reference type for a set of types.
Definition common_reference.hpp:102
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