Skip to content

Commit

Permalink
[libc++] P2590R2: Explicit lifetime management
Browse files Browse the repository at this point in the history
  • Loading branch information
phyBrackets committed Sep 4, 2024
1 parent f612fee commit 73eeb13
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions libcxx/include/__memory/start_lifetime_as.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* start_lifetime_as(void* __p) _NOEXC

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const _Tp* start_lifetime_as(const void* __p) _NOEXCEPT {
return start_lifetime_as<_Tp>(const_cast<void*>(__p));
return std::start_lifetime_as<_Tp>(const_cast<void*>(__p));
}

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR volatile _Tp* start_lifetime_as(volatile void* __p) _NOEXCEPT {
return start_lifetime_as<_Tp>(const_cast<void*>(__p));
return std::start_lifetime_as<_Tp>(const_cast<void*>(__p));
}

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const volatile _Tp* start_lifetime_as(const volatile void* __p) _NOEXCEPT {
return start_lifetime_as<_Tp>(const_cast<void*>(__p));
return std::start_lifetime_as<_Tp>(const_cast<void*>(__p));
}

_LIBCPP_END_NAMESPACE_STD
Expand Down
9 changes: 5 additions & 4 deletions libcxx/include/__memory/start_lifetime_as_array.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,26 @@
_LIBCPP_BEGIN_NAMESPACE_STD

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* start_lifetime_as_array(void* __p, [[maybe_unused]] size_t __n) _NOEXCEPT {
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp*
start_lifetime_as_array(void* __p, [[__maybe_unused__]] size_t __n) _NOEXCEPT {
return static_cast<_Tp*>(__p);
}

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const _Tp* start_lifetime_as_array(const void* __p, size_t __n) _NOEXCEPT {
return start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
return std::start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
}

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR volatile _Tp*
start_lifetime_as_array(volatile void* __p, size_t __n) _NOEXCEPT {
return start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
return std::start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
}

template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const volatile _Tp*
start_lifetime_as_array(const volatile void* __p, size_t __n) _NOEXCEPT {
return start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
return std::start_lifetime_as_array<_Tp>(const_cast<void*>(__p), __n);
}

_LIBCPP_END_NAMESPACE_STD
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/module.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,8 @@ module std_private_memory_shared_ptr [system] {
header "__memory/shared_ptr.h"
export std_private_memory_uninitialized_algorithms
}
module std_private_memory_start_lifetime_as_array [system] { header "__memory/start_lifetime_as_array.h" }
module std_private_memory_start_lifetime_as [system] { header "__memory/start_lifetime_as.h" }
module std_private_memory_swap_allocator [system] { header "__memory/swap_allocator.h" }
module std_private_memory_temp_value [system] { header "__memory/temp_value.h" }
module std_private_memory_temporary_buffer [system] {
Expand Down

0 comments on commit 73eeb13

Please sign in to comment.