Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
in_place.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_ARENE_BASE_UTILITY_IN_PLACE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_IN_PLACE_HPP_
7
8// IWYU pragma: private, include "arene/base/utility.hpp"
9// IWYU pragma: friend "(arene/base(?!/tests)|stdlib/include/stdlib_detail)/.*"
10
11///
12/// @file in_place.hpp
13/// @brief Provides backports of @c std::in_place_t, @c std::in_place_type_t, and @c std::in_place_index_t from C++17.
14///
15
16#include "arene/base/stdlib_choice/cstddef.hpp"
17
18namespace arene {
19namespace base {
20
21/// @brief backport of @c std::in_place_t from C++17
23 public:
24 /// @brief Explicit default constructor to prevent construction from @c {}
25 explicit in_place_t() = default;
26};
27
28// parasoft-begin-suppress AUTOSAR-M3_4_1-b "This is a per-TU reference to a global used in multiple TUs"
29/// @brief backport of @c std::in_place from C++17, a tag variable for in-place construction
30constexpr in_place_t in_place{}; // NOLINT(clang-diagnostic-unused-const-variable) clang seems to false positive here
31// parasoft-end-suppress AUTOSAR-M3_4_1-b
32
33/// @brief backport of @c std::in_place_type_t<T> from C++17
34template <typename T>
36 public:
37 /// @brief Explicit default constructor to prevent construction from @c {}
38 explicit in_place_type_t() = default;
39};
40
41/// @brief backport of @c std::in_place_type<T> from C++17
42template <typename T>
43extern constexpr in_place_type_t<T> in_place_type{};
44
45/// @brief backport of @c std::in_place_index_t<size_t> from C++17
46template <std::size_t I>
48 public:
49 /// @brief Explicit default constructor to prevent construction from @c {}
50 explicit in_place_index_t() = default;
51};
52
53/// @brief backport of @c std::in_place_index<T> from C++17
54template <std::size_t I>
55extern constexpr in_place_index_t<I> in_place_index{};
56
57} // namespace base
58} // namespace arene
59#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_UTILITY_IN_PLACE_HPP_
backport of std::in_place_index_t<size_t> from C++17
Definition in_place.hpp:47
in_place_index_t()=default
Explicit default constructor to prevent construction from {}.
backport of std::in_place_t from C++17
Definition in_place.hpp:22
in_place_t()=default
Explicit default constructor to prevent construction from {}.
backport of std::in_place_type_t<T> from C++17
Definition in_place.hpp:35
in_place_type_t()=default
Explicit default constructor to prevent construction from {}.
Definition array_exceptions_disabled.cpp:11
constexpr in_place_t in_place
backport of std::in_place from C++17, a tag variable for in-place construction
Definition in_place.hpp:30
constexpr in_place_type_t< T > in_place_type
backport of std::in_place_type<T> from C++17
constexpr in_place_index_t< I > in_place_index
backport of std::in_place_index<T> from C++17
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10