Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
forward_as_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_FORWARD_AS_TUPLE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FORWARD_AS_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#include "stdlib/include/stdlib_detail/forward.hpp"
15// parasoft-begin-suppress AUTOSAR-A16_2_2-a "False positive: needed for tuple definition."
16#include "stdlib/include/stdlib_detail/tuple.hpp"
17// parasoft-end-suppress AUTOSAR-A16_2_2-a
18
19namespace std {
20
21// parasoft-begin-suppress AUTOSAR-M3_3_2-a "False positive: inline function used in multiple translation units"
22// parasoft-begin-suppress CERT_C-EXP37-a "False positive: all parameters named"
23/// @brief construct a tuple of references to the provided arguments suitable for forwarding as arguments to a function
24/// call.
25/// @tparam ArgTs types of the tuple members, deduced from @c args
26/// @param args a pack of values used to initialize the tuple
27/// @return std::tuple<Args&&...> A @c tuple constructed as if via @c std::tuple<Args&&...>(std::forward<Args>(args)...)
28/// @note The tuple does not extend the lifetime of any temporaries passed to it. It is the caller's responsibility to
29/// ensure that any references in the returned tuple remain valid for the lifetime of the tuple.
30template <class... ArgTs>
31constexpr auto forward_as_tuple(ArgTs&&... args) noexcept -> tuple<ArgTs&&...> {
32 return tuple<ArgTs&&...>{::std::forward<ArgTs>(args)...};
33}
34// parasoft-end-suppress CERT_C-EXP37-a
35// parasoft-end-suppress AUTOSAR-M3_3_2-a
36
37} // namespace std
38
39#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_FORWARD_AS_TUPLE_HPP_
constexpr auto forward_as_tuple(ArgTs &&... args) noexcept -> tuple< ArgTs &&... >
construct a tuple of references to the provided arguments suitable for forwarding as arguments to a f...
Definition forward_as_tuple.hpp:31
constexpr auto operator()(::arene::base::result< void, E > const &value) const noexcept(noexcept(hash< E >{}(std::declval< E const & >()))) -> std::size_t
Calculate the hash of a result.
Definition result.hpp:1827