Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
new.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_NEW_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NEW_HPP_
7
8// IWYU pragma: private, include <new>
9// IWYU pragma: friend "stdlib_detail/.*"
10
11// parasoft-begin-suppress AUTOSAR-A7_1_5-a-2 "Trailing return syntax permitted by A7-1-5 Permit #1 v1.0.0"
12// parasoft-begin-suppress AUTOSAR-M7_3_1-a "Part of a standard library implementation"
13
14#include "stdlib/include/stdlib_detail/cstddef.hpp"
15
16// parasoft-begin-suppress AUTOSAR-A7_1_2-b "This definition is required by the standard specification."
17/// @brief Implementation of placement new; does no dynamic allocation. This is called for all placement new expressions
18/// of the form <c>new (ptr) Type</c> where @c ptr is convertible to @c void* and no other overload is viable.
19///
20/// This is not a user-replaceable function
21/// @param ptr The address to construct at
22/// @return The supplied @c ptr
23inline auto operator new(std::size_t, void* const ptr) noexcept -> void* { return ptr; }
24// parasoft-end-suppress AUTOSAR-A7_1_2-b
25
26// parasoft-begin-suppress AUTOSAR-A7_1_2-b "This definition is required by the standard specification."
27/// @brief Implementation of placement new for arrays; does no dynamic allocation. This is called for all placement new
28/// expressions of the form <c>new (ptr) Type[count]</c> where @c ptr is convertible to @c void* and no other overload
29/// is viable.
30///
31/// This is not a user-replaceable function
32/// @param ptr The address to construct at
33/// @return The supplied @c ptr
34inline auto operator new[](std::size_t, void* const ptr) noexcept -> void* { return ptr; }
35// parasoft-end-suppress AUTOSAR-A7_1_2-b
36
37// parasoft-begin-suppress AUTOSAR-M0_1_8-b "This definition is required by the standard specification."
38// parasoft-begin-suppress AUTOSAR-A18_5_4-a "This definition is required by the standard specification."
39/// @brief Implementation of placement delete. Used if the constructor called by a placement new expression throws.
40///
41/// This is not a user-replaceable function
42inline void operator delete(void*, void*) noexcept {}
43// parasoft-end-suppress AUTOSAR-A18_5_4-a
44// parasoft-end-suppress AUTOSAR-M0_1_8-b
45
46// parasoft-begin-suppress AUTOSAR-M0_1_8-b "This definition is required by the standard specification."
47// parasoft-begin-suppress AUTOSAR-A18_5_4-a "This definition is required by the standard specification."
48/// @brief Implementation of placement delete for arrays. Used if the constructor called by an array placement new
49/// expression throws.
50///
51/// This is not a user-replaceable function
52inline void operator delete[](void*, void*) noexcept {}
53// parasoft-end-suppress AUTOSAR-A18_5_4-a
54// parasoft-end-suppress AUTOSAR-M0_1_8-b
55
56#endif // INCLUDE_GUARD_ARENE_BASE_STDLIB_INCLUDE_STDLIB_DETAIL_NEW_HPP_
void operator delete(void *, void *) noexcept
Implementation of placement delete. Used if the constructor called by a placement new expression thro...
Definition new.hpp:42
auto operator new(std::size_t, void *const ptr) noexcept -> void *
Implementation of placement new; does no dynamic allocation. This is called for all placement new exp...
Definition new.hpp:23
void operator delete[](void *, void *) noexcept
Implementation of placement delete for arrays. Used if the constructor called by an array placement n...
Definition new.hpp:52
auto operator new[](std::size_t, void *const ptr) noexcept -> void *
Implementation of placement new for arrays; does no dynamic allocation. This is called for all placem...
Definition new.hpp:34