tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
operator.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_NEW_OPERATOR_HPP
4
#define TETL_NEW_OPERATOR_HPP
5
6
#include <
etl/_cstddef/size_t.hpp
>
7
#include <
etl/_utility/ignore_unused.hpp
>
8
9
// Some parts of the new header are declared in the global namespace. To avoid
10
// ODR violations, we include the header <new> if it is available.
11
#if __has_include(<new>)
12
#include <new>
13
#else
14
19
[[nodiscard]]
auto
operator
new
(
etl::size_t
count,
void
* ptr)
noexcept
->
void
*
20
{
21
etl::ignore_unused
(count);
22
return
ptr;
23
}
24
29
[[nodiscard]]
auto
operator
new
[](
etl::size_t
count,
void
* ptr)
noexcept
->
void
*
30
{
31
etl::ignore_unused
(count);
32
return
ptr;
33
}
34
35
#endif
36
37
#endif
// TETL_NEW_OPERATOR_HPP
ignore_unused.hpp
etl::ignore_unused
constexpr auto ignore_unused(Types &&...) -> void
Explicitly ignore arguments or variables.
Definition
ignore_unused.hpp:17
etl::size_t
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition
size_t.hpp:14
size_t.hpp
include
etl
_new
operator.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0