File indexing completed on 2026-05-03 08:13:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___CXX03___MEMORY_ADDRESSOF_H
0011 #define _LIBCPP___CXX03___MEMORY_ADDRESSOF_H
0012
0013 #include <__cxx03/__config>
0014
0015 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0016 # pragma GCC system_header
0017 #endif
0018
0019 _LIBCPP_BEGIN_NAMESPACE_STD
0020
0021 template <class _Tp>
0022 inline _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* addressof(_Tp& __x) _NOEXCEPT {
0023 return __builtin_addressof(__x);
0024 }
0025
0026 #if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
0027
0028
0029
0030
0031 template <class _Tp>
0032 inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
0033 return &__x;
0034 }
0035
0036 # ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
0037 template <class _Tp>
0038 inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
0039 return &__x;
0040 }
0041 # endif
0042
0043 template <class _Tp>
0044 inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
0045 return &__x;
0046 }
0047
0048 template <class _Tp>
0049 inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
0050 return &__x;
0051 }
0052 #endif
0053
0054 #if !defined(_LIBCPP_CXX03_LANG)
0055 template <class _Tp>
0056 _Tp* addressof(const _Tp&&) noexcept = delete;
0057 #endif
0058
0059 _LIBCPP_END_NAMESPACE_STD
0060
0061 #endif