Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
tuple_cat.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_CAT_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_CAT_HPP_
7
8// parasoft-begin-suppress CERT_CPP-DCL58-a-2 "Part of a standard library implementation"
9// parasoft-begin-suppress AUTOSAR-A17_6_1-a-2 "Part of a standard library implementation"
10
11// IWYU pragma: private, include <tuple>
12// IWYU pragma: friend "stdlib_detail/.*"
13
14#include "arene/base/stdlib_choice/declval.hpp"
15#include "arene/base/stdlib_choice/forward.hpp"
16#include "arene/base/stdlib_choice/tuple_fwd.hpp"
22
23namespace std {
24
26
27/// @brief Check if a type is a std::tuple or a std::pair
28/// @tparam Tuple The type to check
29/// @return @c true if the @c Tuple is a @c std::tuple or @c std::pair otherwise @c false
30template <class Tuple>
31extern constexpr auto is_std_tuple_or_pair =
34
35} // namespace tuple_cat_detail
36
37/// @brief concatenate tuples
38/// @tparam Tuples types of the tuples to concatenate
39/// @param tuples @c std::tuple objects to concatenate
40/// @return @c std::tuple whose elements are the concatenation of @p tuples in order
41///
42/// @pre Every argument must be an @c std::tuple or @c std::pair
43/// Passing non-@c std::tuple tuple-likes to @c std::tuple_cat is undefined
44/// behavior per the standard; use @c arene::base::tuple_cat for those.
45// parasoft-begin-suppress AUTOSAR-M2_10_1-a "Similar names permitted by M2-10-1 Permit #1"
46template <class... Tuples, class = decltype(arene::base::tuple_cat(std::declval<Tuples&&>()...))>
47constexpr auto tuple_cat(Tuples&&... tuples
48) noexcept(arene::base::is_nothrow_invocable_v<decltype(arene::base::tuple_cat), Tuples&&...>)
49 -> decltype(arene::base::tuple_cat(std::forward<Tuples>(tuples)...)) {
50 static_assert(
52 "std::tuple_cat requires every argument to be a std::tuple or std::pair; "
53 "use arene::base::tuple_cat to concatenate arbitrary tuple-like types."
54 );
55 return arene::base::tuple_cat(std::forward<Tuples>(tuples)...);
56}
57// parasoft-begin-suppress AUTOSAR-M2_10_1-a "Similar names permitted by M2-10-1 Permit #1"
58
59} // namespace std
60
61// parasoft-end-suppress AUTOSAR-A17_6_1-a-2
62// parasoft-end-suppress CERT_CPP-DCL58-a-2
63
64#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_TUPLE_CAT_HPP_
a heterogeneous, fixed-size collection of values
Definition tuple.hpp:695
constexpr bool is_instantiation_of_v
Definition is_instantiation_of.hpp:16
constexpr bool all_of_v
Trait which tests if every value in a parameter pack is true .
constexpr bool is_nothrow_invocable_v
Determine if a functor type is no-throw invocable with the specified argument types.
Definition tuple_cat.hpp:25
constexpr auto is_std_tuple_or_pair
Check if a type is a std::tuple or a std::pair.
STL namespace.
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
constexpr auto tuple_cat(Tuples &&... tuples) noexcept(arene::base::is_nothrow_invocable_v<, Tuples &&... >) ->
concatenate tuples
Definition tuple_cat.hpp:47
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
Provides the all_of_v<bool...> trait.