aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/libcxx/include/memory
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/libcxx/include/memory')
-rw-r--r--contrib/llvm-project/libcxx/include/memory26
1 files changed, 19 insertions, 7 deletions
diff --git a/contrib/llvm-project/libcxx/include/memory b/contrib/llvm-project/libcxx/include/memory
index 56f8159fbd44..a986d76c8b4e 100644
--- a/contrib/llvm-project/libcxx/include/memory
+++ b/contrib/llvm-project/libcxx/include/memory
@@ -838,6 +838,8 @@ template<size_t N, class T>
*/
+#include <__algorithm/copy.h>
+#include <__algorithm/move.h>
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__memory/addressof.h>
@@ -941,21 +943,31 @@ template <class _Tp, class _Alloc>
struct __temp_value {
typedef allocator_traits<_Alloc> _Traits;
+#ifdef _LIBCPP_CXX03_LANG
typename aligned_storage<sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)>::type __v;
+#else
+ union { _Tp __v; };
+#endif
_Alloc &__a;
- _Tp *__addr() { return reinterpret_cast<_Tp *>(addressof(__v)); }
- _Tp & get() { return *__addr(); }
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp *__addr() {
+#ifdef _LIBCPP_CXX03_LANG
+ return reinterpret_cast<_Tp*>(std::addressof(__v));
+#else
+ return std::addressof(__v);
+#endif
+ }
+
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 _Tp & get() { return *__addr(); }
template<class... _Args>
_LIBCPP_NO_CFI
- __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
- _Traits::construct(__a, reinterpret_cast<_Tp*>(addressof(__v)),
- _VSTD::forward<_Args>(__args)...);
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 __temp_value(_Alloc &__alloc, _Args&& ... __args) : __a(__alloc) {
+ _Traits::construct(__a, __addr(), std::forward<_Args>(__args)...);
}
- ~__temp_value() { _Traits::destroy(__a, __addr()); }
- };
+ _LIBCPP_CONSTEXPR_AFTER_CXX17 ~__temp_value() { _Traits::destroy(__a, __addr()); }
+};
template<typename _Alloc, typename = void, typename = void>
struct __is_allocator : false_type {};