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
// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4
#
ifndef
TETL_MEMORY_ADDRESSOF_HPP
5
#
define
TETL_MEMORY_ADDRESSOF_HPP
6
7
#
include
<
etl
/
_config
/
all
.
hpp
>
8
9
#
include
<
etl
/
_type_traits
/
is_object
.
hpp
>
10
11
namespace
etl
{
12
13
/// Obtains the actual address of the object or function arg, even in presence of overloaded operator&.
14
template
<
typename
T>
15
requires
(is_object_v<T>)
16
constexpr
auto
addressof
(T& arg)
noexcept
-> T*
17
{
18
return
__builtin_addressof(arg);
19
}
20
21
/// Obtains the actual address of the object or function arg, even in presence of overloaded operator&.
22
template
<
typename
T>
23
requires
(
not
is_object_v<T>)
24
constexpr
auto
addressof
(T& arg)
noexcept
-> T*
25
{
26
return
&arg;
27
}
28
29
template
<
typename
T>
30
auto
addressof
(T
const
&&
/*ignore*/
) =
delete
;
31
32
}
// namespace etl
33
34
#
endif
// TETL_MEMORY_ADDRESSOF_HPP
etl
Definition
adjacent_find.hpp:9
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:16
etl::addressof
auto addressof(T const &&)=delete
include
etl
_memory
addressof.hpp
Generated on Sun Sep 7 2025 19:15:10 for tetl by
1.9.8