File indexing completed on 2026-05-03 08:13:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef _LIBCPP___MEMORY_ADDRESSOF_H
0011 #define _LIBCPP___MEMORY_ADDRESSOF_H
0012
0013 #include <__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 _LIBCPP_HAS_OBJC_ARC
0027
0028
0029 template <class _Tp>
0030 inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT {
0031 return &__x;
0032 }
0033
0034 # if _LIBCPP_HAS_OBJC_ARC_WEAK
0035 template <class _Tp>
0036 inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT {
0037 return &__x;
0038 }
0039 # endif
0040
0041 template <class _Tp>
0042 inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT {
0043 return &__x;
0044 }
0045
0046 template <class _Tp>
0047 inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT {
0048 return &__x;
0049 }
0050 #endif
0051
0052 #if !defined(_LIBCPP_CXX03_LANG)
0053 template <class _Tp>
0054 _Tp* addressof(const _Tp&&) noexcept = delete;
0055 #endif
0056
0057 _LIBCPP_END_NAMESPACE_STD
0058
0059 #endif