Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
tuple.hpp
Go to the documentation of this file.
1// Copyright 2026, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_HPP_
7
8// IWYU pragma: private, include <tuple>
9// IWYU pragma: friend "stdlib_detail/.*"
10
11// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
12// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
13
14// parasoft-begin-suppress AUTOSAR-M17_0_3-a "Reserved names are used as part of a standard library implementation"
15// parasoft-begin-suppress CERT_CPP-DCL51-d "Reserved names are used as part of a standard library implementation"
16
17// parasoft-begin-suppress CERT_C-EXP37-a "False positive: The rule does not mention naming all parameters"
18
50
51namespace std {
52
53// parasoft-begin-suppress AUTOSAR-A14_7_2-a "False positive: tuple is defined in the current file"
54
55/// @brief obtain the number of elements in a tuple-like type
56/// @tparam Types parameter pack of element types of a tuple
57template <class... Types>
58class tuple_size<tuple<Types...>> : public integral_constant<size_t, sizeof...(Types)> {};
59
60/// @brief obtain the element type at a given index
61/// @tparam I index to obtain the element type of
62/// @tparam Types parameter pack of element types of a tuple
63/// @note ill-formed if @c I is out of bounds
64///
65template <size_t I, class... Types>
66class tuple_element<I, tuple<Types...>> {
67 public:
68 static_assert(I < sizeof...(Types), "index out of range for the given tuple");
69
70 /// @brief the element type at index @c I
72};
73
74// parasoft-end-suppress AUTOSAR-A14_7_2-a
75
76/// @brief Constructs a tuple of references to the given arguments.
77/// @tparam Types Types of the arguments.
78/// @param args References to the values to include in the tuple.
79/// @return A tuple containing references to the input arguments.
80template <class... Types>
81constexpr auto tie(Types&... args) noexcept -> tuple<Types&...> {
82 return tuple<Types&...>{args...};
83}
84
85namespace tuple_detail {
86/// @brief poison pill declaration of @c __get_tuple_impl
87///
88/// This is to ensure that @c __get_tuple_impl only looks for a function
89/// declaration and does not pick up some other global object named
90/// @c __get_tuple_impl .
91///
92template <class>
93// NOLINTNEXTLINE(readability-identifier-naming): detail within a standard library implemantation
94auto __get_tuple_impl() -> void = delete;
95} // namespace tuple_detail
96
97// parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: inline function used in multiple translation units"
98
99/// @brief access an element of a mutable lvalue reference to a @c tuple
100/// @tparam I index of the element to access
101/// @tparam Types types of the @c tuple
102/// @param tup @c tuple to access an element from
103/// @return reference to the @c I'th element of @c tup
104template <size_t I, class... Types>
105constexpr auto get(tuple<Types...>& tup) noexcept -> tuple_element_t<I, tuple<Types...>>& {
107
108 return __get_tuple_impl<I>(tup).value();
109}
110
111/// @brief access an element of a const lvalue reference to a @c tuple
112/// @tparam I index of the element to access
113/// @tparam Types types of the @c tuple
114/// @param tup @c tuple to access an element from
115/// @return reference to the @c I'th element of @c tup
116template <size_t I, class... Types>
117constexpr auto get(tuple<Types...> const& tup) noexcept -> tuple_element_t<I, tuple<Types...>> const& {
119
120 // parasoft-begin-suppress AUTOSAR-A5_2_3-a "tup data not accessed, and const added back before returning reference"
121 // parasoft-begin-suppress CERT_CPP-EXP55-a "tup data not accessed, and const added back before returning reference"
122 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
123 return __get_tuple_impl<I>(const_cast<tuple<Types...>&>(tup)).value();
124 // parasoft-end-suppress CERT_CPP-EXP55-a
125 // parasoft-end-suppress AUTOSAR-A5_2_3-a
126}
127
128/// @brief access an element of a mutable rvalue reference to a @c tuple
129/// @tparam I index of the element to access
130/// @tparam Types types of the @c tuple
131/// @param tup @c tuple to access an element from
132/// @return reference to the @c I'th element of @c tup
133// parasoft-begin-suppress AUTOSAR-A8_4_6-a "tup variable only used to deduce tuple member to return a reference to"
134// parasoft-begin-suppress AUTOSAR-A8_4_5-a "tup variable only used to deduce tuple member to return a reference to"
135// parasoft-begin-suppress AUTOSAR-A12_8_4-a "tup variable only used to deduce tuple member to return a reference to"
136template <size_t I, class... Types>
137constexpr auto get(tuple<Types...>&& tup) noexcept -> tuple_element_t<I, tuple<Types...>>&& {
139 using return_type = tuple_element_t<I, tuple<Types...>>&&;
140
141 return static_cast<return_type>(__get_tuple_impl<I>(tup).value());
142}
143// parasoft-end-suppress AUTOSAR-A12_8_4-a
144// parasoft-end-suppress AUTOSAR-A8_4_5-a
145// parasoft-end-suppress AUTOSAR-A8_4_6-a
146
147/// @brief access an element of a const rvalue reference to a @c tuple
148/// @tparam I index of the element to access
149/// @tparam Types types of the @c tuple
150/// @param tup @c tuple to access an element from
151/// @return reference to the @c I'th element of @c tup
152template <size_t I, class... Types>
153constexpr auto get(tuple<Types...> const&& tup) noexcept -> tuple_element_t<I, tuple<Types...>> const&& {
155 using return_type = tuple_element_t<I, tuple<Types...>> const&&;
156
157 // parasoft-begin-suppress AUTOSAR-A5_2_3-a "tup data not accessed, and const added back before returning reference"
158 // parasoft-begin-suppress CERT_CPP-EXP55-a "tup data not accessed, and const added back before returning reference"
159 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
160 return static_cast<return_type>(__get_tuple_impl<I>(const_cast<tuple<Types...>&>(tup)).value());
161 // parasoft-end-suppress CERT_CPP-EXP55-a
162 // parasoft-end-suppress AUTOSAR-A5_2_3-a
163}
164
165/// @brief access an element of an lvalue reference to a @c tuple
166/// @tparam T type of the element to access; must occur exactly once within @c tuple
167/// @tparam Types types of the @c tuple
168/// The tuple to access is passed as @c tup.
169/// @cond CPPTEST_PARAMETER_DOCUMENTATION
170/// @param tup The tuple to access
171/// @endcond
172/// @return reference to the only occurrence of @c T within @c tup
173template <class T, class... Types>
174constexpr auto get(tuple<Types...>& tup) noexcept -> T& {
175 constexpr size_t first_idx{::arene::base::index_of_v<T, Types...>};
176 constexpr size_t last_idx{::arene::base::last_index_of_v<T, Types...>};
177 static_assert(
178 first_idx == last_idx,
179 "Type-based std::get<T>(std::tuple<Types...>) can only be used if T appears exactly once in Types, but it "
180 "appears multiple times"
181 );
182
183 return get<first_idx>(tup);
184}
185
186/// @brief access an element of a const lvalue reference to a @c tuple
187/// @tparam T type of the element to access; must occur exactly once within @c tuple
188/// @tparam Types types of the @c tuple
189/// The tuple to access is passed as @c tup.
190/// @cond CPPTEST_PARAMETER_DOCUMENTATION
191/// @param tup The tuple to access
192/// @endcond
193/// @return reference to the only occurrence of @c T within @c tup
194template <class T, class... Types>
195constexpr auto get(tuple<Types...> const& tup) noexcept -> T const& {
196 constexpr size_t first_idx{::arene::base::index_of_v<T, Types...>};
197 constexpr size_t last_idx{::arene::base::last_index_of_v<T, Types...>};
198 static_assert(
199 first_idx == last_idx,
200 "Type-based std::get<T>(std::tuple<Types...>) can only be used if T appears exactly once in Types, but it "
201 "appears multiple times"
202 );
203
204 return get<first_idx>(tup);
205}
206
207/// @brief access an element of an rvalue reference to a @c tuple
208/// @tparam T type of the element to access; must occur exactly once within @c tuple
209/// @tparam Types types of the @c tuple
210/// The tuple to access is passed as @c tup.
211/// @cond CPPTEST_PARAMETER_DOCUMENTATION
212/// @param tup The tuple to access
213/// @endcond
214/// @return reference to the only occurrence of @c T within @c tup
215template <class T, class... Types>
216constexpr auto get(tuple<Types...>&& tup) noexcept -> T&& {
217 constexpr size_t first_idx{::arene::base::index_of_v<T, Types...>};
218 constexpr size_t last_idx{::arene::base::last_index_of_v<T, Types...>};
219 static_assert(
220 first_idx == last_idx,
221 "Type-based std::get<T>(std::tuple<Types...>) can only be used if T appears exactly once in Types, but it "
222 "appears multiple times"
223 );
224
225 return get<first_idx>(std::move(tup));
226}
227
228/// @brief access an element of a const rvalue reference to a @c tuple
229/// @tparam T type of the element to access; must occur exactly once within @c tuple
230/// @tparam Types types of the @c tuple
231/// The tuple to access is passed as @c tup.
232/// @cond CPPTEST_PARAMETER_DOCUMENTATION
233/// @param tup The tuple to access
234/// @endcond
235/// @return reference to the only occurrence of @c T within @c tup
236template <class T, class... Types>
237constexpr auto get(tuple<Types...> const&& tup) noexcept -> T const&& {
238 constexpr size_t first_idx{::arene::base::index_of_v<T, Types...>};
239 constexpr size_t last_idx{::arene::base::last_index_of_v<T, Types...>};
240 static_assert(
241 first_idx == last_idx,
242 "Type-based std::get<T>(std::tuple<Types...>) can only be used if T appears exactly once in Types, but it "
243 "appears multiple times"
244 );
245
246 return get<first_idx>(std::move(tup));
247}
248// parasoft-end-suppress AUTOSAR-M3_3_2-a
249
250namespace tuple_detail {
251
252/// @brief handles reference binding when initializing a reference from a
253/// forwarded argument
254/// @tparam T the target type
255///
256/// This primary template forwards the argument unchanged.
257template <class T, class = void>
259
260/// @brief handles reference binding when initializing a reference from a
261/// forwarded argument
262/// @tparam T the target type without the reference qualifier
263///
264/// When initializing a reference member of type @c T& or @c T&& from an xvalue
265/// (e.g. the result of @c std::forward), [dcl.init.ref] requires
266/// the initializer to be a direct binding and not involve a user-defined
267/// conversion. If the forwarded type is a reference-wrapper-like proxy that
268/// provides a conversion operator to @c T& or @c T&&, the xvalue causes the
269/// direct binding path to be skipped, and the compiler may infer that the
270/// lifetime of the reference is bounded by the lifetime of the temporary,
271/// causing a compilation error.
272///
273/// This specialization ensures that the conversion to @c T& or @c T&& happens
274/// explicitly via @c static_cast before the result is used to initialize
275/// the reference member, producing a reference that satisfies [dcl.init.ref].
276template <class T>
278 public:
279 // parasoft-begin-suppress AUTOSAR-A8_4_6-a-2 "This function object handles a proxy reference conversion"
280 // parasoft-begin-suppress AUTOSAR-A8_4_5-a-2 "This function object handles a proxy reference conversion"
281 // parasoft-begin-suppress AUTOSAR-A12_8_4-a-2 "This function object handles a proxy reference conversion"
282 /// @brief convert the given value to @c T&
283 /// @tparam U the type of the value
284 /// @param value the value to convert
285 /// @return an lvalue reference
286 template <class U>
287 constexpr auto operator()(U&& value) noexcept -> T {
288 return static_cast<T>(value);
289 }
290 // parasoft-end-suppress AUTOSAR-A8_4_6-a-2
291 // parasoft-end-suppress AUTOSAR-A8_4_5-a-2
292 // parasoft-end-suppress AUTOSAR-A12_8_4-a-2
293};
294
295/// @brief contains a single element of a tuple
296/// @tparam I element index
297/// @tparam T element type
298///
299template <size_t I, class T, class = arene::base::constraints<>>
300class tuple_leaf : arene::base::ebo_holder<integral_constant<size_t, I>, remove_const_t<T>> {
301 /// @brief tag type used to access the value within 'ebo_holder'
302 using base_tag_type = integral_constant<size_t, I>;
303
304 public:
306
307 // parasoft-begin-suppress AUTOSAR-M2_10_1-a "Similar names permitted by M2-10-1 Permit #1"
308
309 // parasoft-begin-suppress AUTOSAR-A10_2_1-a "False positive: redefines member of a privately inherited class"
310 /// @brief obtain the value contained in this leaf
311 /// @return reference to the value
312 ///
313 // parasoft-begin-suppress AUTOSAR-A9_3_1-a "This class doesn't contain/own the data, it wraps it with type info"
314 constexpr auto value() & noexcept -> T& { return this->get_value(base_tag_type{}); }
315 // parasoft-end-suppress AUTOSAR-A9_3_1-a
316
317 /// @brief obtain the value contained in this leaf
318 /// @return reference to the value
319 ///
320 constexpr auto value() const& noexcept -> T const& { return this->get_value(base_tag_type{}); }
321 // parasoft-end-suppress AUTOSAR-A10_2_1-a
322
323 // parasoft-end-suppress AUTOSAR-M2_10_1-a
324};
325
326/// @brief helper used in the implementation of a tuple
327/// @tparam Indices type containing the indices of a tuple
328/// @tparam Types type containing the types of a tuple
329///
330/// This primary template is intentionally not defined.
331///
332template <class Indices, class Types>
334
335/// @brief alias to the tuple leaf type at index I of a tuple
336/// @tparam I leaf index
337/// @tparam Tuple tuple type, specialization of std::tuple
338template <std::size_t I, class Tuple>
340
341// parasoft-begin-suppress AUTOSAR-M2_10_1-a "Similar names permitted by M2-10-1 Permit #1"
342
343/// @brief helper used to implement move assignment
344/// @tparam Dest The tuple to copy assign to
345/// @tparam Source The tuple to copy assign from
346/// @tparam Indices Parameter pack of indices for indexing the tuples
347/// @param dest The destination tuple
348/// @param source The source tuple
349template <class Dest, class Source, std::size_t... Indices>
353
354/// @brief helper used to implement swap
355/// @tparam Lhs The type of the first tuple to swap
356/// @tparam Rhs The type of the second tuple to swap
357/// @tparam Indices Parameter pack of indices for indexing the tuples
358/// @param lhs The first tupe to swap
359/// @param rhs The second tupe to swap
360template <class Lhs, class Rhs, std::size_t... Indices>
361void memberwise_swap(Lhs& lhs, Rhs&& rhs, index_sequence<Indices...>) {
362 // parasoft-begin-suppress AUTOSAR-M5_18_1-a "Comma operator avoids an expensive recursive iteration"
364 // parasoft-end-suppress AUTOSAR-M5_18_1-a
365}
366
367// parasoft-end-suppress AUTOSAR-M2_10_1-a
368
369/// @brief determine if a trait predicate is @c true for all pairs of @c T...
370/// and @c U...
371/// @tparam Trait binary predicate type trait to transform @c T... with @c U...
372/// @tparam TupleTypeList type-list containing T types
373/// @tparam List type-list containing U types
374/// @note This is a workaround for pack length expand errors with older GCC
375/// versions
376///
377template <template <class...> class Trait, class TupleTypeList, class List, class = void>
379
380/// @brief determine if a trait predicate is @c true for all pairs of @c T...
381/// and @c U...
382/// @tparam Trait binary predicate type trait to transform @c T... with @c U...
383/// @tparam T types in the destination tuple
384/// @tparam U types paired with @c T...
385/// @note This is a workaround for pack length expand errors with older GCC
386/// versions
387///
388template <template <class...> class Trait, class... T, class... U>
390 Trait,
391 arene::base::type_list<T...>,
393 enable_if_t<sizeof...(T) == sizeof...(U)>> : public bool_constant<arene::base::all_of_v<Trait<T, U>::value...>> {};
394
395// parasoft-begin-suppress AUTOSAR-A14_5_1-a "False positive: There is no single
396// argument template constructor for 'tuple_impl'"
397// parasoft-begin-suppress AUTOSAR-A12_1_5-a "False positive: Delegating constructors are used everywhere they can be"
398
399/// @brief helper used in the implementation of a tuple
400/// @tparam I parameter pack of indices of a tuple
401/// @tparam T parameter pack of types of a tuple
402///
403template <size_t... I, class... T>
404class tuple_impl<index_sequence<I...>, arene::base::type_list<T...>>
405 // this flat implementation is faster to compile than a recursive implementation
406 : public tuple_leaf<I, T>... {
407 /// @brief determine if a trait predicate is @c true for all pairs of @c T...
408 /// and @c U...
409 /// @tparam Trait binary predicate type trait to transform @c T... with @c U...
410 /// @tparam U types paired with @c T...
411 /// @note This is a workaround for pack length expand errors with older GCC
412 /// versions
413 ///
414 template <template <class...> class Trait, class... U>
415 static constexpr bool are_all_arguments_v{
417 };
418
419 public:
420 // parasoft-begin-suppress AUTOSAR-A12_7_1-a "False positive: =default would have different semantics"
421
422 /// @brief default constructor
423 /// @tparam B template parameter used to check constraints
424 ///
425 /// Value-initializes each element of the tuple
426 ///
427 /// @note Requires:
428 /// * @c is_default_constructible<Ti>::value is @c true for all @c Ti in @c Types...
429 ///
430 template <
432 // avoid GCC9 SFINAE error with 'constraints'
433 class = enable_if_t<B>>
434 constexpr tuple_impl() //
435 noexcept(arene::base::all_of_v<is_nothrow_default_constructible_v<T>...>)
436 : tuple_leaf<I, T>{}... {}
437 // parasoft-end-suppress AUTOSAR-A11_3_1-a
438
439 // parasoft-begin-suppress AUTOSAR-A13_3_1-a "This overload, and the overload
440 // with types 'UTypes&&...', are implemented as specified by the
441 // standard."
442
443 /// @brief direct constructor
444 /// @tparam B template parameter used to check constraints
445 /// @tparam N template parameter used to check constraints
446 /// @param args values to initialize with
447 ///
448 /// Initializes each element of the tuple with the corresponding parameter
449 ///
450 /// @note Requires:
451 /// * @c is_copy_constructible<Ti>::value is @c true for all @c Ti in @c Types...
452 /// * <c> sizeof...(Types) != 0 </c> is @c true
453 ///
454 template <
456 size_t N = sizeof...(T),
457 // avoid GCC9 SFINAE error with 'constraints'
458 class = enable_if_t<(N != 0U) && B>>
459 constexpr explicit tuple_impl(T const&... args) //
461 : tuple_leaf<I, T>{args}... {}
462
463 // parasoft-end-suppress AUTOSAR-A13_3_1-a
464
465 /// @brief converting constructor
466 /// @tparam UTypes parameter pack of types to construct from
467 /// @param args values to initialize with
468 ///
469 /// Initializes each element of the tuple with the corresponding parameter
470 ///
471 /// @note Requires:
472 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
473 /// * @c is_constructible<Ti, Ui&&>::value is @c true for all @c Ti in @c
474 /// Types... and @c Ui in @c UTypes...
475 /// * <c> sizeof...(Types) != 0 </c> is @c true
476 ///
477 template <
478 class... UTypes,
479 // avoid GCC9 SFINAE error with 'constraints'
480 class = enable_if_t<
481 (sizeof...(UTypes) != 0U) && //
482 are_all_arguments_v<is_constructible, UTypes&&...> //
483 >>
484 constexpr explicit tuple_impl(UTypes&&... args) //
485 noexcept(are_all_arguments_v<is_nothrow_constructible, UTypes&&...>)
487
488 // NOLINTBEGIN(hicpp-explicit-conversions)
489
490 // parasoft-begin-suppress AUTOSAR-A13_3_1-a "False positive:
491 // 'tuple<Utypes...>&&' in the other constructor overload is not a forwarding
492 // reference"
493
494 /// @brief copy-from-other-tuple constructor
495 /// @tparam UTypes parameter pack of types to construct from
496 /// @param other @c tuple containing values to initialize with
497 ///
498 /// Initializes each element of the tuple from the values in @c other
499 ///
500 /// @note Requires:
501 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
502 /// * @c is_constructible<Ti, Ui const&>::value is @c true for all @c Ti in @c
503 /// Types... and @c Ui in @c UTypes...
504 /// * <c> sizeof...(Types) != 0 </c> is @c true
505 ///
506 template <
507 class... UTypes,
508 // avoid GCC9 SFINAE error with 'constraints'
509 class = enable_if_t<
510 (sizeof...(UTypes) != 0U) && //
511 are_all_arguments_v<is_constructible, UTypes const&...> //
512 >>
513 constexpr tuple_impl(tuple<UTypes...> const& other) //
514 noexcept(are_all_arguments_v<is_nothrow_constructible, UTypes const&...>)
515 : tuple_impl{get<I>(other)...} {}
516
517 // parasoft-end-suppress AUTOSAR-A13_3_1-a
518
519 /// @brief move-from-other-tuple constructor
520 /// @tparam UTypes parameter pack of types to construct from
521 /// @param other @c tuple containing values to initialize with
522 ///
523 /// Initializes each element of the tuple by forwarding the values in @c other
524 ///
525 /// @note Requires:
526 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
527 /// * @c is_constructible<Ti, Ui&&>::value is @c true for all @c Ti in @c
528 /// Types... and @c Ui in @c UTypes...
529 /// * <c> sizeof...(Types) != 0 </c> is @c true
530 ///
531 template <
532 class... UTypes,
533 // avoid GCC9 SFINAE error with 'constraints'
534 class = enable_if_t<
535 (sizeof...(UTypes) != 0U) && //
536 are_all_arguments_v<is_constructible, UTypes&&...> //
537 >>
538 constexpr tuple_impl(tuple<UTypes...>&& other) //
539 noexcept(are_all_arguments_v<is_nothrow_constructible, UTypes&&...>)
540 : tuple_impl{get<I>(std::move(other))...} {}
541
542 // parasoft-begin-suppress AUTOSAR-A13_3_1-a "False positive:
543 // 'pair<Utypes...>&&' in the other constructor overload is not a forwarding
544 // reference"
545
546 /// @brief copy-from-pair constructor
547 /// @tparam UTypes parameter pack of types to construct from
548 /// @param other @c pair containing values to initialize with
549 ///
550 /// Initializes each element of the tuple with a copy of the values in @c other
551 ///
552 /// @note Requires:
553 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
554 /// * @c is_constructible<Ti, Ui const&>::value is @c true for all @c Ti in @c
555 /// Types... and @c Ui in @c UTypes...
556 ///
557 template <
558 class... UTypes,
559 // avoid GCC9 SFINAE error with 'constraints'
560 class = enable_if_t<are_all_arguments_v<is_constructible, UTypes const&...> //
561 >>
562 constexpr tuple_impl(pair<UTypes...> const& other) //
563 noexcept(are_all_arguments_v<is_nothrow_constructible, UTypes const&...>)
564 : tuple_impl{get<0>(other), get<1>(other)} {}
565
566 // parasoft-end-suppress AUTOSAR-A13_3_1-a
567
568 /// @brief move-from-pair constructor
569 /// @tparam UTypes parameter pack of types to construct from
570 /// @param other @c pair containing values to initialize with
571 ///
572 /// Initializes each element of the tuple with a copy of the values in @c other
573 ///
574 /// @note Requires:
575 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
576 /// * @c is_constructible<Ti, Ui&&>::value is @c true for all @c Ti in @c
577 /// Types... and @c Ui in @c UTypes...
578 ///
579 template <
580 class... UTypes,
581 // avoid GCC9 SFINAE error with 'constraints'
582 class = enable_if_t<are_all_arguments_v<is_constructible, UTypes&&...> //
583 >>
584 constexpr tuple_impl(pair<UTypes...>&& other) //
585 noexcept(are_all_arguments_v<is_nothrow_constructible, UTypes&&...>)
586 : tuple_impl{
587 std::forward<tuple_element_t<0, pair<UTypes...>>>(get<0>(other)),
588 std::forward<tuple_element_t<1, pair<UTypes...>>>(get<1>(other))
589 } {}
590
591 // NOLINTEND(hicpp-explicit-conversions)
592};
593
594// parasoft-end-suppress AUTOSAR-A12_1_5-a
595// parasoft-end-suppress AUTOSAR-A14_5_1-a
596
597/// @brief A type trait to determine the noexcept specification of elementwise equality comparison
598/// @tparam LTuple The left tuple to elementwise compare
599/// @tparam RTuple The right tuple to elementwise compare
600template <class LTuple, class RTuple>
602
603/// @brief A type trait to determine the noexcept specification of elementwise equality comparison
604/// @tparam LTypes The element types of the left tuple to elementwise compare
605/// @tparam RTypes The element types of the right tuple to elementwise compare
606template <class... LTypes, class... RTypes>
609
610/// @brief A type trait to determine the noexcept specification of elementwise less-than comparison
611/// @tparam LTuple The left tuple to elementwise compare
612/// @tparam RTuple The right tuple to elementwise compare
613template <class LTuple, class RTuple>
615
616/// @brief A type trait to determine the noexcept specification of elementwise less-than comparison
617/// @tparam LTypes The element types of the left tuple to elementwise compare
618/// @tparam RTypes The element types of the right tuple to elementwise compare
619template <class... LTypes, class... RTypes>
624
625// We have to disable clang-format here because it can't parse the constraints with the "<" in them.
626// clang-format off
627/// @brief Check if element @c Idx and all subsequent elements of the two tuples are equal
628/// @tparam Idx The Idx to begin checking at
629/// @tparam LTypes The parameter types of the left tuple
630/// @tparam RTypes The parameter types of the right tuple
631/// @return @c true if element @c Idx and all subsequent elements of the two tuples are equal
632template <std::size_t Idx, class... LTypes, class... RTypes,
633 ::arene::base::constraints<enable_if_t<Idx == sizeof...(LTypes)>> = nullptr>
634constexpr auto elements_equal(tuple<LTypes...> const&, tuple<RTypes...> const&) noexcept -> bool {
635 return true;
636}
637
638// parasoft-begin-suppress AUTOSAR-M6_2_2-a "This comparison is defined by the standard."
639/// @brief Check if element @c Idx and all subsequent elements of the two tuples are equal
640/// @tparam Idx The Idx to begin checking at
641/// @tparam LTypes The parameter types of the left tuple
642/// @tparam RTypes The parameter types of the right tuple
643/// @param left The left tuple
644/// @param right The right tuple
645/// @return @c true if element @c Idx and all subsequent elements of the two tuples are equal
646template <std::size_t Idx, class... LTypes, class... RTypes,
647 ::arene::base::constraints<enable_if_t<Idx < sizeof...(LTypes)>> = nullptr>
648constexpr auto elements_equal(tuple<LTypes...> const& left, tuple<RTypes...> const& right)
649 noexcept(all_elements_nothrow_equality_comparable_v<tuple<LTypes...>, tuple<RTypes...>>) -> bool {
650 return (get<Idx>(left) == get<Idx>(right)) && ::std::tuple_detail::elements_equal<Idx + 1UL>(left, right);
651}
652// parasoft-end-suppress AUTOSAR-M6_2_2-a
653
654/// @brief Check if the left tuple is less than the right tuple, starting at @c Idx and counting up
655/// @tparam Idx The Idx to begin checking at
656/// @tparam LTypes The parameter types of the left tuple
657/// @tparam RTypes The parameter types of the right tuple
658/// @return @c true if <c>get<Idx>(left) < get<Idx>(right)</c> or if they're equal and
659/// <c>elements_less<Idx + 1>(left, right)</c>
660template <std::size_t Idx, class... LTypes, class... RTypes,
661 ::arene::base::constraints<enable_if_t<Idx == sizeof...(LTypes)>> = nullptr>
662constexpr auto elements_less(tuple<LTypes...> const&, tuple<RTypes...> const&) noexcept -> bool {
663 return false;
664}
665
666/// @brief Check if the left tuple is less than the right tuple, starting at @c Idx and counting up
667/// @tparam Idx The Idx to begin checking at
668/// @tparam LTypes The parameter types of the left tuple
669/// @tparam RTypes The parameter types of the right tuple
670/// @param left The left tuple
671/// @param right The right tuple
672/// @return @c true if <c>get<Idx>(left) < get<Idx>(right)</c> or if they're equal and
673/// <c>elements_less<Idx + 1>(left, right)</c>
674template <std::size_t Idx, class... LTypes, class... RTypes,
675 ::arene::base::constraints<enable_if_t<Idx < sizeof...(LTypes)>> = nullptr>
676constexpr auto elements_less(tuple<LTypes...> const& left, tuple<RTypes...> const& right)
677 noexcept(all_elements_nothrow_less_than_comparable_v<tuple<LTypes...>, tuple<RTypes...>>) -> bool {
678 if (get<Idx>(left) < get<Idx>(right)) {
679 return true;
680 }
681 if (get<Idx>(right) < get<Idx>(left)) {
682 return false;
683 }
684 return ::std::tuple_detail::elements_less<Idx + 1UL>(left, right);
685}
686// clang-format on
687
688} // namespace tuple_detail
689
690// parasoft-begin-suppress AUTOSAR-M2_10_1-a "Similar names permitted by M2-10-1 Permit #1"
691// parasoft-begin-suppress AUTOSAR-A2_7_3-a "False positive: Declaration *is* preceeded by the @brief tag."
692/// @brief a heterogeneous, fixed-size collection of values
693/// @tparam Types the types of elements that the tuple stores
694template <class... Types>
695class tuple : tuple_detail::tuple_impl<index_sequence_for<Types...>, arene::base::type_list<Types...>> {
696 // parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: 'impl_type' does not hide an identifier in 'tuple'"
697 /// @brief implementation type that publicly inherits from the individual tuple elements
698 using impl_type = tuple_detail::tuple_impl<index_sequence_for<Types...>, arene::base::type_list<Types...>>;
699 // parasoft-end-suppress AUTOSAR-A2_10_1-e
700
701 // parasoft-begin-suppress AUTOSAR-A11_3_1-a "Hidden friends permitted by A11-3-1 Permit #2"
702 // parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: inline function used in multiple translation units"
703 // NOLINTBEGIN(readability-identifier-naming): detail within a standard library implemantation
704
705 /// @brief obtain the @c tuple_leaf element at a specified index
706 /// @tparam I tuple element index
707 /// @param tup reference to a @c tuple
708 /// @return reference to the value containing the @c I 'th element
709 /// @note The SFINAE constraint is to prevent ambiguity for a tuple of tuples.
710 /// Without the constraint, ADL finds this friend through the associated
711 /// classes of the template arguments, causing the inner tuple instantiations'
712 /// friends to also be viable candidates via implicit derived-to-base
713 /// conversion.
714 template <
715 size_t I,
716 class Tuple,
718 friend constexpr auto __get_tuple_impl(Tuple& tup) noexcept -> tuple_detail::tuple_leaf_t<I, Tuple>& {
719 return static_cast<tuple_detail::tuple_leaf_t<I, Tuple>&>(static_cast<impl_type&>(tup));
720 }
721 // parasoft-end-suppress AUTOSAR-M3_3_2-a
722 // parasoft-end-suppress AUTOSAR-A11_3_1-a
723 // NOLINTEND(readability-identifier-naming)
724
725 using impl_type::impl_type;
726
727 // parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: 'are_all_arguments_v' does not hide private member
728 // 'are_all_arguments_v' in 'tuple_impl'"
729 /// @brief determine if a trait predicate is @c true for all pairs of @c T...
730 /// and @c U...
731 /// @tparam Trait binary predicate type trait to transform @c T... with @c U...
732 /// @tparam U types paired with @c T...
733 /// @note This is a workaround for pack length expand errors with older GCC
734 /// versions
735 ///
736 template <template <class...> class Trait, class... U>
737 static constexpr bool are_all_arguments_v{
739 };
740 // parasoft-end-suppress AUTOSAR-A2_10_1-e
741
742 // parasoft-begin-suppress AUTOSAR-A2_10_1-e "False positive: 'type_index_sequence' does not hide anything"
743 /// @brief Helper index sequence for @c Types...
744 static constexpr auto type_index_sequence = std::index_sequence_for<Types...>{};
745 // parasoft-end-suppress AUTOSAR-A2_10_1-e
746
747 public:
748 // parasoft-begin-suppress AUTOSAR-A12_8_6-a "False Positive: this is not a base class."
749 /// @brief copy-from-other-tuple assignment
750 /// @tparam UTypes parameter pack of types to assign from
751 /// @param other @c tuple containing values to assign from
752 ///
753 /// Initializes each element of the tuple from the values in @c other
754 ///
755 /// @note Requires:
756 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
757 /// * @c is_assignable<Ti, Ui const&>::value is @c true for all @c Ti in @c
758 /// Types... and @c Ui in @c UTypes...
759 /// * <c> sizeof...(Types) != 0 </c> is @c true
760 ///
761 template <
762 class... UTypes,
763 // avoid GCC9 SFINAE error with 'constraints'
764 class = enable_if_t<
765 (sizeof...(UTypes) != 0U) && //
766 are_all_arguments_v<is_assignable, UTypes const&...> //
767 >>
768 auto operator=(tuple<UTypes...> const& other) noexcept(are_all_arguments_v<is_nothrow_assignable, UTypes const&...>)
769 -> tuple& {
770 tuple_detail::memberwise_forward_assign(*this, other, type_index_sequence);
771 return *this;
772 }
773
774 /// @brief move-from-other-tuple assignment
775 /// @tparam UTypes parameter pack of types to move assign from
776 /// @param other @c tuple containing values to move assign from
777 ///
778 /// Initializes each element of the tuple from the values in @c other
779 ///
780 /// @note Requires:
781 /// * <c> sizeof...(Types) == sizeof...(UTypes) </c> is @c true
782 /// * @c is_assignable<Ti, Ui const&>::value is @c true for all @c Ti in @c
783 /// Types... and @c Ui in @c UTypes...
784 /// * <c> sizeof...(Types) != 0 </c> is @c true
785 ///
786 template <
787 class... UTypes,
788 // avoid GCC9 SFINAE error with 'constraints'
789 class = enable_if_t<
790 (sizeof...(UTypes) != 0U) && //
791 are_all_arguments_v<is_assignable, UTypes&&...> //
792 >>
793 auto operator=(tuple<UTypes...>&& other) noexcept(are_all_arguments_v<is_nothrow_assignable, UTypes&&...>) -> tuple& {
794 tuple_detail::memberwise_forward_assign(*this, std::move(other), type_index_sequence);
795 return *this;
796 }
797
798 /// @brief copy-assign-from-pair constructor
799 /// @tparam U1 first parameter to assign from
800 /// @tparam U2 second parameter to assign from
801 /// @param other @c pair containing values to initialize with
802 ///
803 /// Initializes each element of the tuple with a copy of the values in @c other
804 ///
805 /// @note Requires:
806 /// * <c> sizeof...(Types) == 2 </c> is @c true
807 /// * @c is_assignable<T1, U1 const&>::value and @c is_assignable<T2, U2 const&>::value is @c true
808 ///
809 template <
810 class U1,
811 class U2,
812 class = enable_if_t<
813 (sizeof...(Types) == 2U) && //
814 are_all_arguments_v<is_assignable, U1 const&, U2 const&> //
815 >>
816 auto operator=(pair<U1, U2> const& other) noexcept(are_all_arguments_v<is_nothrow_assignable, U1 const&, U2 const&>)
817 -> tuple& {
818 tuple_detail::memberwise_forward_assign(*this, other, type_index_sequence);
819 return *this;
820 }
821
822 /// @brief move-assign-from-pair constructor
823 /// @tparam U1 first parameter to assign from
824 /// @tparam U2 second parameter to assign from
825 /// @param other @c pair containing values to initialize with
826 ///
827 /// Initializes each element of the tuple by moving the values in @c other
828 ///
829 /// @note Requires:
830 /// * <c> sizeof...(Types) == 2 </c> is @c true
831 /// * @c is_assignable<T1, U1&&>::value and @c is_assignable<T2, U2&&>::value is @c true
832 ///
833 template <
834 class U1,
835 class U2,
836 class = enable_if_t<
837 (sizeof...(Types) == 2U) && //
838 are_all_arguments_v<is_assignable, U1&&, U2&&> //
839 >>
840 auto operator=(pair<U1, U2>&& other) noexcept(are_all_arguments_v<is_nothrow_assignable, U1&&, U2&&>) -> tuple& {
841 tuple_detail::memberwise_forward_assign(*this, std::move(other), type_index_sequence);
842 return *this;
843 }
844 // parasoft-end-suppress AUTOSAR-A12_8_6-a "False Positive: this is not a base class."
845 // parasoft-end-suppress AUTOSAR-M2_10_1-a
846
847 // parasoft-begin-suppress CERT_CPP-ERR50-b-3 AUTOSAR-A15_5_1-a-2 AUTOSAR-A15_5_3-b-2 CERT_CPP-DCL57-a-2 "False
848 // positive: Generic generic swap functions may have noexcept specifications which depend on type properties of the
849 // template parameter"
850 // parasoft-begin-suppress AUTOSAR-A2_10_1-d "False Positive: 'swap' does not hide anything"
851 /// @brief swap with another tuple
852 /// @param rhs the other tuple to swap @c this with
853 /// @post Equivalent to having invoked @c swap(get<Idx>(*this),get<Idx>(rhs)) for every element.
854 ///
855 /// @note Requires:
856 /// * <c> arene::base::all_of_v<arene::base::is_swappable_v<Types>...> </c> is @c true
857 template <
861 tuple_detail::memberwise_swap(*this, rhs, type_index_sequence);
862 }
863 // parasoft-end-suppress AUTOSAR-A2_10_1-d
864 // parasoft-end-suppress CERT_CPP-ERR50-b-3 AUTOSAR-A15_5_1-a-2 AUTOSAR-A15_5_3-b-2 CERT_CPP-DCL57-a-2
865};
866// parasoft-begin-suppress AUTOSAR-A2_7_3-a
867
868/// @brief swap two tuples
869/// @tparam Types The types in the two tuples to be swapped
870/// @param lhs the first tuple to swap
871/// @param rhs the second tuple to swap
872/// @post Equivalent to having invoked @c swap(get<Idx>(lhs),get<Idx>(rhs)) for every element.
873///
874/// @note Requires:
875/// * <c> arene::base::all_of_v<arene::base::is_swappable_v<Types>...> </c> is @c true
876// parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: This should not have the static keyword applied"
877template <
878 class... Types,
880auto swap(tuple<Types...>& lhs, tuple<Types...>& rhs) noexcept(
881 noexcept(std::declval<tuple<Types...>&>().swap(std::declval<tuple<Types...>&>()))
882) -> void {
883 lhs.swap(rhs);
884}
885// parasoft-end-suppress AUTOSAR-M3_3_2-a
886
887// parasoft-begin-suppress AUTOSAR-A13_5_5-b "This is how the comparison operators are specified in C++14"
888/// @brief Compare two tuples by doing an equality comparison on their elements starting from 0
889/// @tparam LTypes The element types of the left tuple
890/// @tparam RTypes The element types of the right tuple
891/// @param left The left tuple to compare
892/// @param right The right tuple to compare
893/// @return @c true if the elements of @c left all compare equal to those of <c>right</c>, otherwise @c false
894template <class... LTypes, class... RTypes>
895constexpr auto operator==(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(
896 noexcept(::std::tuple_detail::elements_equal<0UL>(left, right))
897) -> bool {
898 // This is a "Requires" clause in the standard, so it's implemented as a static_assert rather than a constraint.
899 static_assert(sizeof...(LTypes) == sizeof...(RTypes), "Only tuples of the same size can be compared");
900 return ::std::tuple_detail::elements_equal<0UL>(left, right);
901}
902
903/// @brief Compare two tuples by doing an equality comparison on their elements starting from 0
904/// @tparam LTypes The element types of the left tuple
905/// @tparam RTypes The element types of the right tuple
906/// @param left The left tuple to compare
907/// @param right The right tuple to compare
908/// @return @c true if any of the elements of @c left compare unequal to those of <c>right</c>, otherwise @c false
909template <class... LTypes, class... RTypes>
910constexpr auto operator!=(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(noexcept(left == right))
911 -> bool {
912 return !(left == right);
913}
914
915/// @brief Compare two tuples by doing a lexicographic comparison on their elements starting from 0
916/// @tparam LTypes The element types of the left tuple
917/// @tparam RTypes The element types of the right tuple
918/// @param left The left tuple to compare
919/// @param right The right tuple to compare
920/// @return @c true if a lexicographic comparison of the elements gives "less", otherwise @c false
921template <class... LTypes, class... RTypes>
922constexpr auto operator<(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(
923 noexcept(::std::tuple_detail::elements_less<0UL>(left, right))
924) -> bool {
925 // This is a "Requires" clause in the standard, so it's implemented as a static_assert rather than a constraint.
926 static_assert(sizeof...(LTypes) == sizeof...(RTypes), "Only tuples of the same size can be compared");
927 return ::std::tuple_detail::elements_less<0UL>(left, right);
928}
929
930/// @brief Compare two tuples by doing a lexicographic comparison on their elements starting from 0
931/// @tparam LTypes The element types of the left tuple
932/// @tparam RTypes The element types of the right tuple
933/// @param left The left tuple to compare
934/// @param right The right tuple to compare
935/// @return @c true if a lexicographic comparison of the elements gives "less" or "equal", otherwise @c false
936template <class... LTypes, class... RTypes>
937constexpr auto operator<=(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(noexcept(right < left))
938 -> bool {
939 return !(right < left);
940}
941
942/// @brief Compare two tuples by doing a lexicographic comparison on their elements starting from 0
943/// @tparam LTypes The element types of the left tuple
944/// @tparam RTypes The element types of the right tuple
945/// @param left The left tuple to compare
946/// @param right The right tuple to compare
947/// @return @c true if a lexicographic comparison of the elements gives "greater", otherwise @c false
948template <class... LTypes, class... RTypes>
949constexpr auto operator>(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(noexcept(right < left))
950 -> bool {
951 return right < left;
952}
953
954/// @brief Compare two tuples by doing a lexicographic comparison on their elements starting from 0
955/// @tparam LTypes The element types of the left tuple
956/// @tparam RTypes The element types of the right tuple
957/// @param left The left tuple to compare
958/// @param right The right tuple to compare
959/// @return @c true if a lexicographic comparison of the elements gives "greater" or "equal", otherwise @c false
960template <class... LTypes, class... RTypes>
961constexpr auto operator>=(tuple<LTypes...> const& left, tuple<RTypes...> const& right) noexcept(noexcept(left < right))
962 -> bool {
963 return !(left < right);
964}
965// parasoft-end-suppress AUTOSAR-A13_5_5-b
966
967} // namespace std
968
969#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_HPP_
A class to hold an instance of a type that is likely to be empty, such as a comparator or allocator,...
Definition ebo_holder.hpp:42
constexpr ebo_holder() noexcept(std::is_nothrow_default_constructible< T >::value)
Definition ebo_holder.hpp:57
constexpr auto get_value(integral_constant< size_t, I >) const &noexcept -> value_type const &
Definition ebo_holder.hpp:89
A backport of the C++20 std::identity function object. It returns its input unchanged.
Definition identity.hpp:21
A helper class to represent a compile-time constant with the specified type and value....
Definition integral_constant.hpp:23
Type trait to detect if a type is constructible from arguments of the specified types.
Definition is_constructible.hpp:29
Type trait to detect if an instance of To is assignable to from arguments of From without throwing.
Definition is_assignable.hpp:78
Type trait to detect if a type is constructible from arguments of the specified types and is noexcept...
Definition is_constructible.hpp:84
determine if a trait predicate is true for all pairs of T... and U...
Definition tuple.hpp:378
constexpr auto operator()(U &&value) noexcept -> T
convert the given value to T&
Definition tuple.hpp:287
handles reference binding when initializing a reference from a forwarded argument
Definition tuple.hpp:258
constexpr tuple_impl() noexcept(arene::base::all_of_v< is_nothrow_default_constructible_v< T >... >)
default constructor
Definition tuple.hpp:434
constexpr tuple_impl(pair< UTypes... > const &other) noexcept(are_all_arguments_v< is_nothrow_constructible, UTypes const &... >)
copy-from-pair constructor
Definition tuple.hpp:562
constexpr tuple_impl(tuple< UTypes... > const &other) noexcept(are_all_arguments_v< is_nothrow_constructible, UTypes const &... >)
copy-from-other-tuple constructor
Definition tuple.hpp:513
constexpr tuple_impl(pair< UTypes... > &&other) noexcept(are_all_arguments_v< is_nothrow_constructible, UTypes &&... >)
move-from-pair constructor
Definition tuple.hpp:584
constexpr tuple_impl(tuple< UTypes... > &&other) noexcept(are_all_arguments_v< is_nothrow_constructible, UTypes &&... >)
move-from-other-tuple constructor
Definition tuple.hpp:538
constexpr tuple_impl(T const &... args) noexcept(arene::base::all_of_v< is_nothrow_copy_constructible_v< T >... >)
direct constructor
Definition tuple.hpp:459
constexpr tuple_impl(UTypes &&... args) noexcept(are_all_arguments_v< is_nothrow_constructible, UTypes &&... >)
converting constructor
Definition tuple.hpp:484
helper used in the implementation of a tuple
Definition tuple.hpp:333
contains a single element of a tuple
Definition tuple.hpp:300
constexpr auto value() const &noexcept -> T const &
obtain the value contained in this leaf
Definition tuple.hpp:320
constexpr auto value() &noexcept -> T &
obtain the value contained in this leaf
Definition tuple.hpp:314
arene::base::type_lists::at_t< arene::base::type_list< Types... >, I > type
the element type at index I
Definition tuple.hpp:71
obtains the type of the specified element
Definition tuple_element.hpp:28
obtain the number of elements in a tuple-like type
Definition tuple_size.hpp:22
a heterogeneous, fixed-size collection of values
Definition tuple.hpp:695
friend constexpr auto __get_tuple_impl(Tuple &tup) noexcept -> tuple_detail::tuple_leaf_t< I, Tuple > &
obtain the tuple_leaf element at a specified index
Definition tuple.hpp:718
auto swap(tuple &rhs) noexcept(arene::base::all_of_v< arene::base::is_nothrow_swappable_v< Types >... >) -> void
swap with another tuple
Definition tuple.hpp:860
Public export header for the constraints subpackage.
typename at< L0, Index >::type at_t
Get the n-th element from a type list.
Definition at.hpp:113
constexpr auto last_index_of_v
Template meta-function for querying the last 0-based index of 'T' within a list of types,...
constexpr void consume_values(std::initializer_list< consume_values_detail::anything > const &) noexcept
Consume a list of values and discard them. Must be called with an extra pair of braces around the exp...
Definition consume_values.hpp:73
constexpr bool all_of_v
Trait which tests if every value in a parameter pack is true .
constexpr bool is_nothrow_equality_comparable_v
constexpr auto index_of_v
Template meta-function for querying the 0-based index of 'T' within a list of types,...
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
Definition tuple.hpp:85
constexpr auto elements_less(tuple< LTypes... > const &, tuple< RTypes... > const &) noexcept -> bool
Check if the left tuple is less than the right tuple, starting at Idx and counting up.
Definition tuple.hpp:662
constexpr bool all_elements_nothrow_equality_comparable_v
A type trait to determine the noexcept specification of elementwise equality comparison.
Definition tuple.hpp:601
auto __get_tuple_impl() -> void=delete
poison pill declaration of __get_tuple_impl
constexpr bool all_elements_nothrow_less_than_comparable_v
A type trait to determine the noexcept specification of elementwise less-than comparison.
Definition tuple.hpp:614
void memberwise_forward_assign(Dest &dest, Source &&source, index_sequence< Indices... >)
helper used to implement move assignment
Definition tuple.hpp:350
tuple_leaf< I, tuple_element_t< I, Tuple > > tuple_leaf_t
alias to the tuple leaf type at index I of a tuple
Definition tuple.hpp:339
void memberwise_swap(Lhs &lhs, Rhs &&rhs, index_sequence< Indices... >)
helper used to implement swap
Definition tuple.hpp:361
constexpr auto elements_equal(tuple< LTypes... > const &, tuple< RTypes... > const &) noexcept -> bool
Check if element Idx and all subsequent elements of the two tuples are equal.
Definition tuple.hpp:634
STL namespace.
constexpr Type integral_constant< Type, Value >::value
Out-of-line definition for the value constant.
Definition integral_constant.hpp:64
auto operator<=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is less than or equal to another.
Definition move_iterator.hpp:294
void swap(pair< T1, T2 > &lhs, pair< T1, T2 > &rhs) noexcept(arene::base::is_nothrow_swappable_v< T1 > &&arene::base::is_nothrow_swappable_v< T2 >)
Swap a pair with another instance of the same type. Swaps lhs.first with rhs.first and swaps lhs....
Definition pair.hpp:448
auto operator>=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is greater than or equal to another.
Definition move_iterator.hpp:316
bool_constant< false > false_type
An alias for bool_constant<false>
Definition integral_constant.hpp:79
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
integral_constant< bool, Value > bool_constant
An alias for integral_constant<bool,Value>
Definition integral_constant.hpp:71
auto operator!=(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if two iterators are not equal.
Definition move_iterator.hpp:271
integer_sequence< size_t, Ints... > index_sequence
A helper alias template for integer_sequence<size_t, Ints>
Definition integer_sequence.hpp:218
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29
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
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
auto operator<(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is less than another.
Definition move_iterator.hpp:283
auto operator==(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if two iterators are equal.
Definition move_iterator.hpp:258
constexpr auto tie(Types &... args) noexcept -> tuple< Types &... >
Constructs a tuple of references to the given arguments.
Definition tuple.hpp:81
constexpr bool is_reference_v
Check if the supplied template argument is a reference or not. The value is true if so,...
typename tuple_element< I, T >::type tuple_element_t
obtains the type of the specified element
Definition tuple_element.hpp:68
constexpr auto get(pair< T1, T2 > &values) noexcept -> tuple_element_t< I, pair< T1, T2 > > &
access an element of a pair
Definition pair.hpp:665
make_index_sequence< sizeof...(Types)> index_sequence_for
A helper alias template convert any type parameter pack into an index sequence of the same length.
Definition integer_sequence.hpp:230
constexpr bool is_nothrow_default_constructible_v
Type trait to detect if an instance of T is default constructible without throwing.
typename remove_const< Type >::type remove_const_t
remove const from the provided type. An alias for the modified type.
Definition remove_const.hpp:36
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24
auto operator>(move_iterator< Iterator1 > const &lhs, move_iterator< Iterator2 > const &rhs) -> bool
Check if one iterator is greater than another.
Definition move_iterator.hpp:305
an empty struct that is a list of types - cheaper to instantiate than tuple
Definition type_list.hpp:19
Provides the all_of_v<bool...> trait.