Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
implicit_constructor_base.hpp
Go to the documentation of this file.
1// Copyright 2024, Toyota Motor Corporation
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_MANIPULATION_IMPLICIT_CONSTRUCTOR_BASE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_MANIPULATION_IMPLICIT_CONSTRUCTOR_BASE_HPP_
7
8// parasoft-begin-suppress AUTOSAR-A16_2_2-a-2 "Arene Base aggregate headers permitted by A16-2-2 Permit #1"
9#include "arene/base/stdlib_choice/is_constructible.hpp"
10
11// parasoft-begin-suppress CERT_C-EXP37-a-3 "False positive: The rule does not mention naming all parameters"
12// parasoft-begin-suppress AUTOSAR-A12_0_1-a-2 "implicit_constructor_base has no content so doesn't need assignment
13// operators"
14// parasoft-begin-suppress AUTOSAR-A1_1_1-b-2 "False positive: This is all conforming code"
15
16namespace arene {
17namespace base {
18
19/// @brief A class that has the same implicit constructors as another type.
20///
21/// It is intended for use as a base class for other types that define the
22/// constructors with @c =default, so they remain trivial when present,
23/// but are deleted when @c T does not provide them.
24/// @tparam T The type to copy the properties from
25template <
26 typename T,
27 bool = std::is_constructible<T, T const&>::value,
28 bool = std::is_constructible<T, T&>::value,
29 bool = std::is_constructible<T, T const&&>::value,
30 bool = std::is_constructible<T, T&&>::value>
32
33// @cond INTERNAL
34/// @brief A class that has the same implicit constructors as another type.
35///
36/// It is intended for use as a base class for other types that define the
37/// constructors with @c =default, so they remain trivial when present,
38/// but are deleted when @c T does not provide them.
39/// @tparam T The type to copy the properties from
40template <typename T>
41// NOLINTNEXTLINE(hicpp-special-member-functions)
42class implicit_constructor_base<T, false, false, false, false> {
43 protected:
44 /// @brief Defaulted constructor
45 implicit_constructor_base() noexcept = default;
46 /// @brief Deleted constructor
47 // NOLINTNEXTLINE(hicpp-use-equals-delete)
48 implicit_constructor_base(implicit_constructor_base const&) = delete;
49 /// @brief Deleted constructor
50 // NOLINTNEXTLINE(hicpp-use-equals-delete)
51 implicit_constructor_base(implicit_constructor_base&) = delete;
52 /// @brief Deleted constructor
53 // NOLINTNEXTLINE(hicpp-use-equals-delete)
54 implicit_constructor_base(implicit_constructor_base const&&) = delete;
55 /// @brief Deleted constructor
56 // NOLINTNEXTLINE(hicpp-use-equals-delete)
57 implicit_constructor_base(implicit_constructor_base&&) = delete;
58};
59
60/// @brief A class that has the same implicit constructors as another type.
61///
62/// It is intended for use as a base class for other types that define the
63/// constructors with @c =default, so they remain trivial when present,
64/// but are deleted when @c T does not provide them.
65/// @tparam T The type to copy the properties from
66template <typename T>
67// NOLINTNEXTLINE(hicpp-special-member-functions)
68class implicit_constructor_base<T, true, false, false, false> {
69 protected:
70 /// @brief Defaulted constructor
71 implicit_constructor_base() noexcept = default;
72 /// @brief Defaulted constructor
74 /// @brief Deleted constructor
75 // NOLINTNEXTLINE(hicpp-use-equals-delete)
77 /// @brief Deleted constructor
78 // NOLINTNEXTLINE(hicpp-use-equals-delete)
80 /// @brief Deleted constructor
81 // NOLINTNEXTLINE(hicpp-use-equals-delete)
83};
84
85/// @brief A class that has the same implicit constructors as another type.
86///
87/// It is intended for use as a base class for other types that define the
88/// constructors with @c =default, so they remain trivial when present,
89/// but are deleted when @c T does not provide them.
90/// @tparam T The type to copy the properties from
91template <typename T>
92// NOLINTNEXTLINE(hicpp-special-member-functions)
93class implicit_constructor_base<T, false, true, false, false> {
94 protected:
95 /// @brief Defaulted constructor
96 implicit_constructor_base() noexcept = default;
97 /// @brief Deleted constructor
98 // NOLINTNEXTLINE(hicpp-use-equals-delete)
100 /// @brief Defaulted constructor
102 /// @brief Deleted constructor
103 // NOLINTNEXTLINE(hicpp-use-equals-delete)
105 /// @brief Deleted constructor
106 // NOLINTNEXTLINE(hicpp-use-equals-delete)
108};
109
110/// @brief A class that has the same implicit constructors as another type.
111///
112/// It is intended for use as a base class for other types that define the
113/// constructors with @c =default, so they remain trivial when present,
114/// but are deleted when @c T does not provide them.
115/// @tparam T The type to copy the properties from
116template <typename T>
117// NOLINTNEXTLINE(hicpp-special-member-functions)
118class implicit_constructor_base<T, true, true, false, false> {
119 protected:
120 /// @brief Defaulted constructor
121 implicit_constructor_base() noexcept = default;
122 /// @brief Defaulted constructor
123 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
124 /// @brief Defaulted constructor
126 /// @brief Deleted constructor
127 // NOLINTNEXTLINE(hicpp-use-equals-delete)
129 /// @brief Deleted constructor
130 // NOLINTNEXTLINE(hicpp-use-equals-delete)
132};
133
134/// @brief A class that has the same implicit constructors as another type.
135///
136/// It is intended for use as a base class for other types that define the
137/// constructors with @c =default, so they remain trivial when present,
138/// but are deleted when @c T does not provide them.
139/// @tparam T The type to copy the properties from
140template <typename T>
141// NOLINTNEXTLINE(hicpp-special-member-functions)
142class implicit_constructor_base<T, false, false, true, false> {
143 protected:
144 /// @brief Defaulted constructor
145 implicit_constructor_base() noexcept = default;
146 /// @brief Deleted constructor
147 // NOLINTNEXTLINE(hicpp-use-equals-delete)
149 /// @brief Deleted constructor
150 // NOLINTNEXTLINE(hicpp-use-equals-delete)
152 /// @brief Do-nothing constructor
154 /// @brief Deleted constructor
155 // NOLINTNEXTLINE(hicpp-use-equals-delete)
157};
158
159/// @brief A class that has the same implicit constructors as another type.
160///
161/// It is intended for use as a base class for other types that define the
162/// constructors with @c =default, so they remain trivial when present,
163/// but are deleted when @c T does not provide them.
164/// @tparam T The type to copy the properties from
165template <typename T>
166// NOLINTNEXTLINE(hicpp-special-member-functions)
167class implicit_constructor_base<T, true, false, true, false> {
168 protected:
169 /// @brief Defaulted constructor
170 implicit_constructor_base() noexcept = default;
171 /// @brief Defaulted constructor
172 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
173 /// @brief Deleted constructor
174 // NOLINTNEXTLINE(hicpp-use-equals-delete)
176 /// @brief Do-nothing constructor
178 /// @brief Deleted constructor
179 // NOLINTNEXTLINE(hicpp-use-equals-delete)
181};
182
183/// @brief A class that has the same implicit constructors as another type.
184///
185/// It is intended for use as a base class for other types that define the
186/// constructors with @c =default, so they remain trivial when present,
187/// but are deleted when @c T does not provide them.
188/// @tparam T The type to copy the properties from
189template <typename T>
190// NOLINTNEXTLINE(hicpp-special-member-functions)
191class implicit_constructor_base<T, false, true, true, false> {
192 protected:
193 /// @brief Defaulted constructor
194 implicit_constructor_base() noexcept = default;
195 /// @brief Deleted constructor
196 // NOLINTNEXTLINE(hicpp-use-equals-delete)
198 /// @brief Defaulted constructor
200 /// @brief do-nothing constructor
202 /// @brief Deleted constructor
203 // NOLINTNEXTLINE(hicpp-use-equals-delete)
205};
206
207/// @brief A class that has the same implicit constructors as another type.
208///
209/// It is intended for use as a base class for other types that define the
210/// constructors with @c =default, so they remain trivial when present,
211/// but are deleted when @c T does not provide them.
212/// @tparam T The type to copy the properties from
213template <typename T>
214// NOLINTNEXTLINE(hicpp-special-member-functions)
215class implicit_constructor_base<T, true, true, true, false> {
216 protected:
217 /// @brief Defaulted constructor
218 implicit_constructor_base() noexcept = default;
219 /// @brief Defaulted constructor
220 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
221 /// @brief Defaulted constructor
223 /// @brief do-nothing constructor
225 /// @brief Deleted constructor
226 // NOLINTNEXTLINE(hicpp-use-equals-delete)
228};
229
230/// @brief A class that has the same implicit constructors as another type.
231///
232/// It is intended for use as a base class for other types that define the
233/// constructors with @c =default, so they remain trivial when present,
234/// but are deleted when @c T does not provide them.
235/// @tparam T The type to copy the properties from
236template <typename T>
237// NOLINTNEXTLINE(hicpp-special-member-functions)
238class implicit_constructor_base<T, false, false, false, true> {
239 protected:
240 /// @brief Defaulted constructor
241 implicit_constructor_base() noexcept = default;
242 /// @brief Deleted constructor
243 // NOLINTNEXTLINE(hicpp-use-equals-delete)
245 /// @brief Deleted constructor
246 // NOLINTNEXTLINE(hicpp-use-equals-delete)
248 /// @brief Deleted constructor
249 // NOLINTNEXTLINE(hicpp-use-equals-delete)
251 /// @brief Defaulted constructor
253};
254
255/// @brief A class that has the same implicit constructors as another type.
256///
257/// It is intended for use as a base class for other types that define the
258/// constructors with @c =default, so they remain trivial when present,
259/// but are deleted when @c T does not provide them.
260/// @tparam T The type to copy the properties from
261template <typename T>
262// NOLINTNEXTLINE(hicpp-special-member-functions)
263class implicit_constructor_base<T, true, false, false, true> {
264 protected:
265 /// @brief Defaulted constructor
266 implicit_constructor_base() noexcept = default;
267 /// @brief Defaulted constructor
268 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
269 /// @brief Deleted constructor
270 // NOLINTNEXTLINE(hicpp-use-equals-delete)
272 /// @brief Deleted constructor
273 // NOLINTNEXTLINE(hicpp-use-equals-delete)
275 /// @brief Defaulted constructor
277};
278
279/// @brief A class that has the same implicit constructors as another type.
280///
281/// It is intended for use as a base class for other types that define the
282/// constructors with @c =default, so they remain trivial when present,
283/// but are deleted when @c T does not provide them.
284/// @tparam T The type to copy the properties from
285template <typename T>
286// NOLINTNEXTLINE(hicpp-special-member-functions)
287class implicit_constructor_base<T, false, true, false, true> {
288 protected:
289 /// @brief Defaulted constructor
290 implicit_constructor_base() noexcept = default;
291 /// @brief Deleted constructor
292 // NOLINTNEXTLINE(hicpp-use-equals-delete)
294 /// @brief Defaulted constructor
296 /// @brief Deleted constructor
297 // NOLINTNEXTLINE(hicpp-use-equals-delete)
299 /// @brief Defaulted constructor
301};
302
303/// @brief A class that has the same implicit constructors as another type.
304///
305/// It is intended for use as a base class for other types that define the
306/// constructors with @c =default, so they remain trivial when present,
307/// but are deleted when @c T does not provide them.
308/// @tparam T The type to copy the properties from
309template <typename T>
310// NOLINTNEXTLINE(hicpp-special-member-functions)
311class implicit_constructor_base<T, true, true, false, true> {
312 protected:
313 /// @brief Defaulted constructor
314 implicit_constructor_base() noexcept = default;
315 /// @brief Defaulted constructor
316 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
317 /// @brief Defaulted constructor
319 /// @brief Deleted constructor
320 // NOLINTNEXTLINE(hicpp-use-equals-delete)
322 /// @brief Defaulted constructor
324};
325
326/// @brief A class that has the same implicit constructors as another type.
327///
328/// It is intended for use as a base class for other types that define the
329/// constructors with @c =default, so they remain trivial when present,
330/// but are deleted when @c T does not provide them.
331/// @tparam T The type to copy the properties from
332template <typename T>
333// NOLINTNEXTLINE(hicpp-special-member-functions)
334class implicit_constructor_base<T, false, false, true, true> {
335 protected:
336 /// @brief Defaulted constructor
337 implicit_constructor_base() noexcept = default;
338 /// @brief Deleted constructor
339 // NOLINTNEXTLINE(hicpp-use-equals-delete)
341 /// @brief Deleted constructor
342 // NOLINTNEXTLINE(hicpp-use-equals-delete)
344 /// @brief Defaulted constructor
346};
347
348/// @brief A class that has the same implicit constructors as another type.
349///
350/// It is intended for use as a base class for other types that define the
351/// constructors with @c =default, so they remain trivial when present,
352/// but are deleted when @c T does not provide them.
353/// @tparam T The type to copy the properties from
354template <typename T>
355// NOLINTNEXTLINE(hicpp-special-member-functions)
356class implicit_constructor_base<T, true, false, true, true> {
357 protected:
358 /// @brief Defaulted constructor
359 implicit_constructor_base() noexcept = default;
360 /// @brief Defaulted constructor
361 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
362 /// @brief Deleted constructor
363 // NOLINTNEXTLINE(hicpp-use-equals-delete)
365 /// @brief Defaulted constructor
367};
368
369/// @brief A class that has the same implicit constructors as another type.
370///
371/// It is intended for use as a base class for other types that define the
372/// constructors with @c =default, so they remain trivial when present,
373/// but are deleted when @c T does not provide them.
374/// @tparam T The type to copy the properties from
375template <typename T>
376// NOLINTNEXTLINE(hicpp-special-member-functions)
377class implicit_constructor_base<T, false, true, true, true> {
378 protected:
379 /// @brief Defaulted constructor
380 implicit_constructor_base() noexcept = default;
381 /// @brief Deleted constructor
382 // NOLINTNEXTLINE(hicpp-use-equals-delete)
384 /// @brief Defaulted constructor
386 /// @brief Defaulted constructor
388};
389
390/// @brief A class that has the same implicit constructors as another type.
391///
392/// It is intended for use as a base class for other types that define the
393/// constructors with @c =default, so they remain trivial when present,
394/// but are deleted when @c T does not provide them.
395/// @tparam T The type to copy the properties from
396template <typename T>
397// NOLINTNEXTLINE(hicpp-special-member-functions)
398class implicit_constructor_base<T, true, true, true, true> {
399 protected:
400 /// @brief Defaulted constructor
401 implicit_constructor_base() noexcept = default;
402 /// @brief Defaulted constructor
403 implicit_constructor_base(implicit_constructor_base const&) noexcept = default;
404 /// @brief Defaulted constructor
406 /// @brief Defaulted constructor
408};
409// @endcond
410
411} // namespace base
412} // namespace arene
413
414#endif // INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_TYPE_MANIPULATION_IMPLICIT_CONSTRUCTOR_BASE_HPP_
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10