tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
addressof.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_MEMORY_ADDRESSOF_HPP
4
#define TETL_MEMORY_ADDRESSOF_HPP
5
6
#include <
etl/_config/all.hpp
>
7
8
#include <
etl/_type_traits/is_object.hpp
>
9
10
namespace
etl
{
11
13
template
<
typename
T>
14
requires
(
is_object_v<T>
)
15
constexpr
auto
addressof
(T&
arg
)
noexcept
-> T*
16
{
17
return
__builtin_addressof(
arg
);
18
}
19
21
template
<
typename
T>
22
requires
(not
is_object_v<T>
)
23
constexpr
auto
addressof
(T&
arg
)
noexcept
-> T*
24
{
25
return
&
arg
;
26
}
27
28
template
<
typename
T>
29
auto
addressof
(T
const
&&
/*ignore*/
) =
delete
;
30
31
}
// namespace etl
32
33
#endif
// TETL_MEMORY_ADDRESSOF_HPP
all.hpp
etl::arg
constexpr auto arg(complex< T > const &z) noexcept -> T
Definition
arg.hpp:15
is_object.hpp
etl
Definition
adjacent_find.hpp:8
etl::addressof
constexpr auto addressof(T &arg) noexcept -> T *
Obtains the actual address of the object or function arg, even in presence of overloaded operator&.
Definition
addressof.hpp:15
etl::is_object_v
constexpr bool is_object_v
Definition
is_object.hpp:35
include
etl
_memory
addressof.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0