diff --git a/libcxx/docs/Status/LFTSv3.rst b/libcxx/docs/Status/LFTSv3.rst new file mode 100644 --- /dev/null +++ b/libcxx/docs/Status/LFTSv3.rst @@ -0,0 +1,31 @@ +.. lftsv3-status: + +======================================== +libc++ Library Fundamentals TS v3 Status +======================================== + +.. include:: ../Helpers/Styles.rst + +.. contents:: + :local: + + +Overview +======== + +This document contains the status of the Library Fundamentals TS v3 (LFTSv3) in libc++. +It is used to track both the status of the sub-projects and who is assigned to +these sub-projects. This is imperative to effective implementation so that work +is not duplicated and implementors are not blocked by each other. + +If you are interested in contributing to the libc++ LFTSv3, please send +a message to the #libcxx channel in the LLVM discord. Please *do not* start +working on any of the assigned items below. + +Sub-Projects in the Format library +================================== + +.. csv-table:: + :file: FormatPaper.csv + :header-rows: 1 + :widths: auto diff --git a/libcxx/docs/Status/LFTSv3Paper.csv b/libcxx/docs/Status/LFTSv3Paper.csv new file mode 100644 --- /dev/null +++ b/libcxx/docs/Status/LFTSv3Paper.csv @@ -0,0 +1,10 @@ +Section,Description,Dependencies,Status +`[utilities] `_,"",,Not assigned,|Complete| +`[propagate_const] `_,"",,,|Complete| +`[meta] `_,"",,Not assigned,|Partial| +`[func] `_,"",,Not assigned,|Not Started| +`[memory] `_,"",,Not assigned,|Not Started| +`[iterator] `_,"",,,|Complete| +`[futures] `_,"",,Not assigned,|Not Started| +`[algorithms] `_,"",,Not assigned,|Not Started| +`[numeric] `_,"",,Not assigned,|Not Started| diff --git a/libcxx/include/experimental/__config b/libcxx/include/experimental/__config --- a/libcxx/include/experimental/__config +++ b/libcxx/include/experimental/__config @@ -20,17 +20,19 @@ #define _LIBCPP_END_NAMESPACE_EXPERIMENTAL } } #define _VSTD_EXPERIMENTAL std::experimental -#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 { +#if _LIBCPP_STD_VER <= 17 +#define _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20(symbol) _LIBCPP_DEPRECATED_("The library fundamentals TS is now based on C++20. " symbol " will only be available in C++20 in LLVM 19.") +#else +#define _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20(symbol) +#endif + +#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v3 { #define _LIBCPP_END_NAMESPACE_LFTS } } } -#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v1 +#define _VSTD_LFTS _VSTD_EXPERIMENTAL::fundamentals_v3 -#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 { +#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v3 { #define _LIBCPP_END_NAMESPACE_LFTS_V2 } } } -#define _VSTD_LFTS_V2 _VSTD_EXPERIMENTAL::fundamentals_v2 - -#define _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR _LIBCPP_BEGIN_NAMESPACE_LFTS namespace pmr { -#define _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_END_NAMESPACE_LFTS } -#define _VSTD_LFTS_PMR _VSTD_LFTS::pmr +#define _VSTD_LFTS_V2 _VSTD_EXPERIMENTAL::fundamentals_v3 #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \ _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 { diff --git a/libcxx/include/experimental/__memory b/libcxx/include/experimental/__memory deleted file mode 100644 --- a/libcxx/include/experimental/__memory +++ /dev/null @@ -1,120 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL___MEMORY -#define _LIBCPP_EXPERIMENTAL___MEMORY - -#include <__memory/allocator_arg_t.h> -#include <__memory/uses_allocator.h> -#include <__type_traits/conditional.h> -#include <__type_traits/is_constructible.h> -#include <__type_traits/is_convertible.h> -#include <__type_traits/is_same.h> -#include -#include // for erased_type - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -template < - class _Tp, class _Alloc - , bool = uses_allocator<_Tp, _Alloc>::value - , bool = __has_allocator_type<_Tp>::value - > -struct __lfts_uses_allocator : public false_type {}; - -template -struct __lfts_uses_allocator<_Tp, _Alloc, false, false> : public false_type {}; - -template -struct __lfts_uses_allocator<_Tp, _Alloc, true, HasAlloc> : public true_type {}; - -template -struct __lfts_uses_allocator<_Tp, _Alloc, false, true> - : public integral_constant::value - || is_same::value - > -{}; - -template -struct __lfts_uses_alloc_ctor_imp -{ - static const int value = 0; -}; - -template -struct __lfts_uses_alloc_ctor_imp -{ - static const bool __ic_first - = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; - - static const bool __ic_second = - __conditional_t< - __ic_first, - false_type, - is_constructible<_Tp, _Args..., _Alloc> - >::value; - - static_assert(__ic_first || __ic_second, - "Request for uses allocator construction is ill-formed"); - - static const int value = __ic_first ? 1 : 2; -}; - -template -struct __lfts_uses_alloc_ctor - : integral_constant::value - , _Tp, _Alloc, _Args... - >::value - > -{}; - -template -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &, _Args &&... __args ) -{ - new (__storage) _Tp (_VSTD::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) -{ - new (__storage) _Tp (allocator_arg_t(), __a, _VSTD::forward<_Args>(__args)...); -} - -// FIXME: This should have a version which takes a non-const alloc. -template -inline _LIBCPP_INLINE_VISIBILITY -void __user_alloc_construct_impl (integral_constant, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) -{ - new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a); -} - -template -inline _LIBCPP_INLINE_VISIBILITY -void __lfts_user_alloc_construct( - _Tp * __store, const _Alloc & __a, _Args &&... __args) -{ - ::std::experimental::fundamentals_v1::__user_alloc_construct_impl( - typename __lfts_uses_alloc_ctor<_Tp, _Alloc, _Args...>::type() - , __store, __a, _VSTD::forward<_Args>(__args)... - ); -} - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_EXPERIMENTAL___MEMORY */ diff --git a/libcxx/include/experimental/deque b/libcxx/include/experimental/deque deleted file mode 100644 --- a/libcxx/include/experimental/deque +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_DEQUE -#define _LIBCPP_EXPERIMENTAL_DEQUE - -/* - experimental/deque synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template - using deque = std::deque>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template -using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_DEQUE */ diff --git a/libcxx/include/experimental/forward_list b/libcxx/include/experimental/forward_list deleted file mode 100644 --- a/libcxx/include/experimental/forward_list +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_FORWARD_LIST -#define _LIBCPP_EXPERIMENTAL_FORWARD_LIST - -/* - experimental/forward_list synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template - using forward_list = std::forward_list>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template -using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */ diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -70,7 +70,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS template > -class ostream_joiner { +class _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("ostream_joiner") ostream_joiner { public: typedef _CharT char_type; @@ -111,6 +111,7 @@ template +_LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("make_ostream_joiner") _LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits> make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) { return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } diff --git a/libcxx/include/experimental/list b/libcxx/include/experimental/list deleted file mode 100644 --- a/libcxx/include/experimental/list +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_LIST -#define _LIBCPP_EXPERIMENTAL_LIST - -/* - experimental/list synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template - using list = std::list>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template -using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_LIST */ diff --git a/libcxx/include/experimental/map b/libcxx/include/experimental/map deleted file mode 100644 --- a/libcxx/include/experimental/map +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_MAP -#define _LIBCPP_EXPERIMENTAL_MAP - -/* - experimental/map synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template > - using map = std::map>>; - - template > - using multimap = std::multimap>>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template > -using map = _VSTD::map<_Key, _Value, _Compare, - polymorphic_allocator>>; - -template > -using multimap = _VSTD::multimap<_Key, _Value, _Compare, - polymorphic_allocator>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_MAP */ diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -20,22 +20,6 @@ inline namespace fundamentals_v1 { namespace pmr { - class memory_resource; - - bool operator==(const memory_resource& a, - const memory_resource& b) noexcept; - bool operator!=(const memory_resource& a, - const memory_resource& b) noexcept; - - template class polymorphic_allocator; - - template - bool operator==(const polymorphic_allocator& a, - const polymorphic_allocator& b) noexcept; - template - bool operator!=(const polymorphic_allocator& a, - const polymorphic_allocator& b) noexcept; - // The name resource_adaptor_imp is for exposition only. template class resource_adaptor_imp; @@ -43,20 +27,6 @@ using resource_adaptor = resource_adaptor_imp< allocator_traits::rebind_alloc>; - // Global memory resources - memory_resource* new_delete_resource() noexcept; - memory_resource* null_memory_resource() noexcept; - - // The default memory resource - memory_resource* set_default_resource(memory_resource* r) noexcept; - memory_resource* get_default_resource() noexcept; - - // Standard memory resources - struct pool_options; - class synchronized_pool_resource; - class unsynchronized_pool_resource; - class monotonic_buffer_resource; - } // namespace pmr } // namespace fundamentals_v1 } // namespace experimental @@ -70,8 +40,8 @@ #include <__utility/move.h> #include #include -#include #include +#include #include #include #include @@ -83,13 +53,9 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +namespace std::experimental::inline fundamentals_v3::pmr { -#define _LIBCPP_DEPCREATED_MEMORY_RESOURCE(name) \ - _LIBCPP_DEPRECATED_("'std::experimental::pmr::" name \ - "' is deprecated and will be removed in LLVM 18. Use 'std::pmr::" name "' instead.") - -#ifndef _LIBCPP_CXX03_LANG +#if _LIBCPP_STD_VER >= 20 // Round __s up to next multiple of __a. inline _LIBCPP_INLINE_VISIBILITY @@ -99,250 +65,13 @@ return (__s + __a - 1) & ~(__a - 1); } -// 8.5, memory.resource -class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("memory_resource") _LIBCPP_EXPORTED_FROM_ABI memory_resource -{ - static const size_t __max_align = _LIBCPP_ALIGNOF(max_align_t); - -// 8.5.2, memory.resource.public -public: - _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~memory_resource() = default; - - _LIBCPP_INLINE_VISIBILITY - void* allocate(size_t __bytes, size_t __align = __max_align) - { return do_allocate(__bytes, __align); } - - _LIBCPP_INLINE_VISIBILITY - void deallocate(void * __p, size_t __bytes, size_t __align = __max_align) - { do_deallocate(__p, __bytes, __align); } - - _LIBCPP_INLINE_VISIBILITY - bool is_equal(memory_resource const & __other) const _NOEXCEPT - { return do_is_equal(__other); } - -// 8.5.3, memory.resource.priv -private: - virtual void* do_allocate(size_t, size_t) = 0; - virtual void do_deallocate(void*, size_t, size_t) = 0; - virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0; -}; - -// 8.5.4, memory.resource.eq -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY -bool operator==(memory_resource const & __lhs, - memory_resource const & __rhs) _NOEXCEPT -{ - return &__lhs == &__rhs || __lhs.is_equal(__rhs); -} - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(memory_resource const & __lhs, - memory_resource const & __rhs) _NOEXCEPT -{ - return !(__lhs == __rhs); -} - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("new_delete_resource()") _LIBCPP_EXPORTED_FROM_ABI -memory_resource * new_delete_resource() _NOEXCEPT; - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("null_memory_resource()") _LIBCPP_EXPORTED_FROM_ABI -memory_resource * null_memory_resource() _NOEXCEPT; - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("get_default_resource()") _LIBCPP_EXPORTED_FROM_ABI -memory_resource * get_default_resource() _NOEXCEPT; - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("set_default_resource()") _LIBCPP_EXPORTED_FROM_ABI -memory_resource * set_default_resource(memory_resource * __new_res) _NOEXCEPT; - -// 8.6, memory.polymorphic.allocator.class - -// 8.6.1, memory.polymorphic.allocator.overview -template -class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("polymorphic_allocator") _LIBCPP_TEMPLATE_VIS polymorphic_allocator -{ -public: - typedef _ValueType value_type; - - // 8.6.2, memory.polymorphic.allocator.ctor - _LIBCPP_INLINE_VISIBILITY - polymorphic_allocator() _NOEXCEPT - : __res_(_VSTD_LFTS_PMR::get_default_resource()) - {} - - _LIBCPP_INLINE_VISIBILITY - polymorphic_allocator(memory_resource * __r) _NOEXCEPT - : __res_(__r) - {} - - _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(polymorphic_allocator const &) = default; - - template - _LIBCPP_INLINE_VISIBILITY - polymorphic_allocator(polymorphic_allocator<_Tp> const & __other) _NOEXCEPT - : __res_(__other.resource()) - {} - - polymorphic_allocator & - operator=(polymorphic_allocator const &) = delete; - - // 8.6.3, memory.polymorphic.allocator.mem - _LIBCPP_INLINE_VISIBILITY - _ValueType* allocate(size_t __n) { - if (__n > __max_size()) - __throw_bad_array_new_length(); - return static_cast<_ValueType*>( - __res_->allocate(__n * sizeof(_ValueType), _LIBCPP_ALIGNOF(_ValueType)) - ); - } - - _LIBCPP_INLINE_VISIBILITY - void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT { - _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), - "deallocate called for size which exceeds max_size()"); - __res_->deallocate(__p, __n * sizeof(_ValueType), _LIBCPP_ALIGNOF(_ValueType)); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(_Tp* __p, _Ts &&... __args) - { - _VSTD_LFTS::__lfts_user_alloc_construct( - __p, *this, _VSTD::forward<_Ts>(__args)... - ); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(pair<_T1, _T2>* __p, piecewise_construct_t, - tuple<_Args1...> __x, tuple<_Args2...> __y) - { - ::new ((void*)__p) pair<_T1, _T2>(piecewise_construct - , __transform_tuple( - typename __lfts_uses_alloc_ctor< - _T1, polymorphic_allocator&, _Args1... - >::type() - , _VSTD::move(__x) - , typename __make_tuple_indices::type{} - ) - , __transform_tuple( - typename __lfts_uses_alloc_ctor< - _T2, polymorphic_allocator&, _Args2... - >::type() - , _VSTD::move(__y) - , typename __make_tuple_indices::type{} - ) - ); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(pair<_T1, _T2>* __p) { - construct(__p, piecewise_construct, tuple<>(), tuple<>()); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(pair<_T1, _T2> * __p, _Up && __u, _Vp && __v) { - construct(__p, piecewise_construct - , _VSTD::forward_as_tuple(_VSTD::forward<_Up>(__u)) - , _VSTD::forward_as_tuple(_VSTD::forward<_Vp>(__v))); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> const & __pr) { - construct(__p, piecewise_construct - , _VSTD::forward_as_tuple(__pr.first) - , _VSTD::forward_as_tuple(__pr.second)); - } - - template - _LIBCPP_INLINE_VISIBILITY - void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> && __pr){ - construct(__p, piecewise_construct - , _VSTD::forward_as_tuple(_VSTD::forward<_U1>(__pr.first)) - , _VSTD::forward_as_tuple(_VSTD::forward<_U2>(__pr.second))); - } - - template - _LIBCPP_INLINE_VISIBILITY - void destroy(_Tp * __p) _NOEXCEPT - { __p->~_Tp(); } - - _LIBCPP_INLINE_VISIBILITY - polymorphic_allocator - select_on_container_copy_construction() const _NOEXCEPT - { return polymorphic_allocator(); } - - _LIBCPP_INLINE_VISIBILITY - memory_resource * resource() const _NOEXCEPT - { return __res_; } - -private: - template - _LIBCPP_INLINE_VISIBILITY - tuple<_Args&&...> - __transform_tuple(integral_constant, tuple<_Args...>&& __t, - __tuple_indices<_Idx...>) const - { - return _VSTD::forward_as_tuple(_VSTD::get<_Idx>(_VSTD::move(__t))...); - } - - template - _LIBCPP_INLINE_VISIBILITY - tuple - __transform_tuple(integral_constant, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) - { - using _Tup = tuple; - return _Tup(allocator_arg, *this, - _VSTD::get<_Idx>(_VSTD::move(__t))...); - } - - template - _LIBCPP_INLINE_VISIBILITY - tuple<_Args&&..., polymorphic_allocator&> - __transform_tuple(integral_constant, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) - { - using _Tup = tuple<_Args&&..., polymorphic_allocator&>; - return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., *this); - } - - _LIBCPP_INLINE_VISIBILITY - size_t __max_size() const _NOEXCEPT - { return numeric_limits::max() / sizeof(value_type); } - - memory_resource * __res_; -}; - -// 8.6.4, memory.polymorphic.allocator.eq - -template -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(const polymorphic_allocator&, const polymorphic_allocator&)") -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(polymorphic_allocator<_Tp> const & __lhs, - polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT -{ - return *__lhs.resource() == *__rhs.resource(); -} - -template -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(const polymorphic_allocator&, const polymorphic_allocator&)") -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(polymorphic_allocator<_Tp> const & __lhs, - polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT -{ - return !(__lhs == __rhs); -} - // 8.7, memory.resource.adaptor _LIBCPP_SUPPRESS_DEPRECATED_PUSH // 8.7.1, memory.resource.adaptor.overview template class _LIBCPP_TEMPLATE_VIS __resource_adaptor_imp - : public memory_resource + : public std::pmr::memory_resource { using _CTraits = allocator_traits<_CharAlloc>; static_assert(is_same::value @@ -421,9 +150,9 @@ >; _LIBCPP_SUPPRESS_DEPRECATED_POP -#endif // _LIBCPP_CXX03_LANG +#endif // _LIBCPP_STD_VER >= 20 -_LIBCPP_END_NAMESPACE_LFTS_PMR +} // namespace std::experimental::fundamentals_v3::pmr _LIBCPP_POP_MACROS diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const --- a/libcxx/include/experimental/propagate_const +++ b/libcxx/include/experimental/propagate_const @@ -154,7 +154,7 @@ _Up& get_underlying(propagate_const<_Up>& __pu) _NOEXCEPT; template -class propagate_const +class _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("propagate_const") propagate_const { public: typedef remove_reference_t())> element_type; @@ -504,90 +504,90 @@ _LIBCPP_BEGIN_NAMESPACE_STD template -struct hash> +struct hash> { typedef size_t result_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> argument_type; + typedef experimental::propagate_const<_Tp> argument_type; - _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1) const + _LIBCPP_HIDE_FROM_ABI size_t operator()(const experimental::propagate_const<_Tp>& __pc1) const { return std::hash<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1)); } }; template -struct equal_to> +struct equal_to> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } }; template -struct not_equal_to> +struct not_equal_to> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::not_equal_to<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } }; template -struct less> +struct less> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::less<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } }; template -struct greater> +struct greater> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::greater<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } }; template -struct less_equal> +struct less_equal> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::less_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } }; template -struct greater_equal> +struct greater_equal> { - typedef experimental::fundamentals_v2::propagate_const<_Tp> first_argument_type; - typedef experimental::fundamentals_v2::propagate_const<_Tp> second_argument_type; + typedef experimental::propagate_const<_Tp> first_argument_type; + typedef experimental::propagate_const<_Tp> second_argument_type; - _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::fundamentals_v2::propagate_const<_Tp>& __pc1, - const experimental::fundamentals_v2::propagate_const<_Tp>& __pc2) const + _LIBCPP_HIDE_FROM_ABI bool operator()(const experimental::propagate_const<_Tp>& __pc1, + const experimental::propagate_const<_Tp>& __pc2) const { return std::greater_equal<_Tp>()(_VSTD_LFTS_V2::get_underlying(__pc1), _VSTD_LFTS_V2::get_underlying(__pc2)); } diff --git a/libcxx/include/experimental/regex b/libcxx/include/experimental/regex deleted file mode 100644 --- a/libcxx/include/experimental/regex +++ /dev/null @@ -1,69 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_REGEX -#define _LIBCPP_EXPERIMENTAL_REGEX - -/* - experimental/regex synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template - using match_results = - std::match_results>>; - - typedef match_results cmatch; - typedef match_results wcmatch; - typedef match_results smatch; - typedef match_results wsmatch; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template -using match_results = - _VSTD::match_results<_BiDirIter, - polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>; - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("cmatch") typedef match_results cmatch; -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("smatch") typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("wcmatch") typedef match_results wcmatch; -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("wsmatch") typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch; -#endif - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_REGEX */ diff --git a/libcxx/include/experimental/set b/libcxx/include/experimental/set deleted file mode 100644 --- a/libcxx/include/experimental/set +++ /dev/null @@ -1,62 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_SET -#define _LIBCPP_EXPERIMENTAL_SET - -/* - experimental/set synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template > - using set = std::set>>; - - template > - using multiset = std::multiset>>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template > -using set = _VSTD::set<_Value, _Compare, - polymorphic_allocator<_Value>>; - -template > -using multiset = _VSTD::multiset<_Value, _Compare, - polymorphic_allocator<_Value>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_SET */ diff --git a/libcxx/include/experimental/string b/libcxx/include/experimental/string deleted file mode 100644 --- a/libcxx/include/experimental/string +++ /dev/null @@ -1,73 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_STRING -#define _LIBCPP_EXPERIMENTAL_STRING - -/* - experimental/string synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - // basic_string using polymorphic allocator in namespace pmr - template > - using basic_string = - std::basic_string>; - - // basic_string typedef names using polymorphic allocator in namespace - // std::experimental::pmr - typedef basic_string string; - typedef basic_string u16string; - typedef basic_string u32string; - typedef basic_string wstring; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -_LIBCPP_SUPPRESS_DEPRECATED_PUSH - -template > -using basic_string = - _VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; - -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("string") typedef basic_string string; -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("u16string") typedef basic_string u16string; -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("u32string") typedef basic_string u32string; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_DEPCREATED_MEMORY_RESOURCE("wstring") typedef basic_string wstring; -#endif - -_LIBCPP_SUPPRESS_DEPRECATED_POP - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_STRING */ diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits --- a/libcxx/include/experimental/type_traits +++ b/libcxx/include/experimental/type_traits @@ -103,10 +103,7 @@ using raw_invocation_type_t = typename raw_invocation_type<_Tp>::type; */ -// 3.3.4, Detection idiom -template using void_t = void; - -struct nonesuch : private __nat { // make nonesuch "not an aggregate" +struct _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("nonesuch") nonesuch : private __nat { // make nonesuch "not an aggregate" ~nonesuch() = delete; nonesuch (nonesuch const&) = delete; void operator=(nonesuch const&) = delete; @@ -130,7 +127,7 @@ template class _Op, class... _Args> using detected_t = typename _DETECTOR::type; template class _Op, class... _Args> - _LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value; + _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("is_detected_v") _LIBCPP_CONSTEXPR bool is_detected_v = is_detected<_Op, _Args...>::value; template class _Op, class... _Args> using detected_or = _DETECTOR<_Default, void, _Op, _Args...>; @@ -140,12 +137,12 @@ template class _Op, class... _Args> using is_detected_exact = is_same<_Expected, detected_t<_Op, _Args...>>; template class _Op, class... _Args> - _LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value; + _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("is_detected_exact_v") _LIBCPP_CONSTEXPR bool is_detected_exact_v = is_detected_exact<_Expected, _Op, _Args...>::value; template class _Op, class... _Args> using is_detected_convertible = is_convertible, _To>; template class _Op, class... _Args> - _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value; + _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("is_detected_convertible_v") _LIBCPP_CONSTEXPR bool is_detected_convertible_v = is_detected_convertible<_To, _Op, _Args...>::value; _LIBCPP_END_NAMESPACE_LFTS diff --git a/libcxx/include/experimental/unordered_map b/libcxx/include/experimental/unordered_map deleted file mode 100644 --- a/libcxx/include/experimental/unordered_map +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_MAP -#define _LIBCPP_EXPERIMENTAL_UNORDERED_MAP - -/* - experimental/unordered_map synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template , - class Pred = equal_to> - using unordered_map = - std::unordered_map>>; - - template , - class Pred = equal_to> - using unordered_multimap = - std::unordered_multimap>>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template , class _Pred = equal_to<_Key>> -using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred, - polymorphic_allocator>>; - -template , class _Pred = equal_to<_Key>> -using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred, - polymorphic_allocator>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 -# include -# include -# include -# include -# include -#endif - -#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */ diff --git a/libcxx/include/experimental/unordered_set b/libcxx/include/experimental/unordered_set deleted file mode 100644 --- a/libcxx/include/experimental/unordered_set +++ /dev/null @@ -1,64 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_UNORDERED_SET -#define _LIBCPP_EXPERIMENTAL_UNORDERED_SET - -/* - experimental/unordered_set synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template , class Pred = equal_to> - using unordered_set = std::unordered_set>; - - template , class Pred = equal_to> - using unordered_multiset = std::unordered_multiset>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template , class _Pred = equal_to<_Value>> -using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred, - polymorphic_allocator<_Value>>; - -template , class _Pred = equal_to<_Value>> -using unordered_multiset = _VSTD::unordered_multiset<_Value, _Hash, _Pred, - polymorphic_allocator<_Value>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_SET */ diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility --- a/libcxx/include/experimental/utility +++ b/libcxx/include/experimental/utility @@ -40,7 +40,7 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS - struct _LIBCPP_TEMPLATE_VIS erased_type { }; +struct _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_LFTS_IS_NOW_CXX20("erased_type") erased_type { }; _LIBCPP_END_NAMESPACE_LFTS diff --git a/libcxx/include/experimental/vector b/libcxx/include/experimental/vector deleted file mode 100644 --- a/libcxx/include/experimental/vector +++ /dev/null @@ -1,52 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP_EXPERIMENTAL_VECTOR -#define _LIBCPP_EXPERIMENTAL_VECTOR - -/* - experimental/vector synopsis - -// C++1z -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { -namespace pmr { - - template - using vector = std::vector>; - -} // namespace pmr -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include -#include -#include - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -#ifndef _LIBCPP_CXX03_LANG - -template -using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>; - -#endif // _LIBCPP_CXX03_LANG - -_LIBCPP_END_NAMESPACE_LFTS_PMR - -#endif /* _LIBCPP_EXPERIMENTAL_VECTOR */ diff --git a/libcxx/src/experimental/memory_resource.cpp b/libcxx/src/experimental/memory_resource.cpp deleted file mode 100644 --- a/libcxx/src/experimental/memory_resource.cpp +++ /dev/null @@ -1,149 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#include - -_LIBCPP_SUPPRESS_DEPRECATED_PUSH - -#ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER -# include -#elif !defined(_LIBCPP_HAS_NO_THREADS) -# include -# if defined(__ELF__) && defined(_LIBCPP_LINK_PTHREAD_LIB) -# pragma comment(lib, "pthread") -# endif -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR - -// memory_resource - -//memory_resource::~memory_resource() {} - -// new_delete_resource() - -class _LIBCPP_EXPORTED_FROM_ABI __new_delete_memory_resource_imp - : public memory_resource -{ - void *do_allocate(size_t size, size_t align) override { -#ifdef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION - if (__is_overaligned_for_new(align)) - __throw_bad_alloc(); -#endif - return _VSTD::__libcpp_allocate(size, align); - } - - void do_deallocate(void *p, size_t n, size_t align) override { - _VSTD::__libcpp_deallocate(p, n, align); - } - - bool do_is_equal(memory_resource const & other) const noexcept override - { return &other == this; } - -public: - ~__new_delete_memory_resource_imp() override = default; -}; - -// null_memory_resource() - -class _LIBCPP_EXPORTED_FROM_ABI __null_memory_resource_imp - : public memory_resource -{ -public: - ~__null_memory_resource_imp() = default; - -protected: - virtual void* do_allocate(size_t, size_t) { - __throw_bad_alloc(); - } - virtual void do_deallocate(void *, size_t, size_t) {} - virtual bool do_is_equal(memory_resource const & __other) const noexcept - { return &__other == this; } -}; - -namespace { - -union ResourceInitHelper { - struct { - __new_delete_memory_resource_imp new_delete_res; - __null_memory_resource_imp null_res; - } resources; - char dummy; - _LIBCPP_CONSTEXPR_SINCE_CXX14 ResourceInitHelper() : resources() {} - ~ResourceInitHelper() {} -}; - -// Pretend we're inside a system header so the compiler doesn't flag the use of the init_priority -// attribute with a value that's reserved for the implementation (we're the implementation). -#include "memory_resource_init_helper.h" - -} // end namespace - - -memory_resource * new_delete_resource() noexcept { - return &res_init.resources.new_delete_res; -} - -memory_resource * null_memory_resource() noexcept { - return &res_init.resources.null_res; -} - -// default_memory_resource() - -static memory_resource * -__default_memory_resource(bool set = false, memory_resource * new_res = nullptr) noexcept -{ -#ifndef _LIBCPP_HAS_NO_ATOMIC_HEADER - static constinit atomic __res{&res_init.resources.new_delete_res}; - if (set) { - new_res = new_res ? new_res : new_delete_resource(); - // TODO: Can a weaker ordering be used? - return _VSTD::atomic_exchange_explicit( - &__res, new_res, memory_order_acq_rel); - } - else { - return _VSTD::atomic_load_explicit( - &__res, memory_order_acquire); - } -#elif !defined(_LIBCPP_HAS_NO_THREADS) - static constinit memory_resource *res = &res_init.resources.new_delete_res; - static mutex res_lock; - if (set) { - new_res = new_res ? new_res : new_delete_resource(); - lock_guard guard(res_lock); - memory_resource * old_res = res; - res = new_res; - return old_res; - } else { - lock_guard guard(res_lock); - return res; - } -#else - static constinit memory_resource *res = &res_init.resources.new_delete_res; - if (set) { - new_res = new_res ? new_res : new_delete_resource(); - memory_resource * old_res = res; - res = new_res; - return old_res; - } else { - return res; - } -#endif -} - -memory_resource * get_default_resource() noexcept -{ - return __default_memory_resource(); -} - -memory_resource * set_default_resource(memory_resource * __new_res) noexcept -{ - return __default_memory_resource(true, __new_res); -} - -_LIBCPP_END_NAMESPACE_LFTS_PMR diff --git a/libcxx/src/experimental/memory_resource_init_helper.h b/libcxx/src/experimental/memory_resource_init_helper.h deleted file mode 100644 --- a/libcxx/src/experimental/memory_resource_init_helper.h +++ /dev/null @@ -1,2 +0,0 @@ -#pragma GCC system_header -static constinit ResourceInitHelper res_init _LIBCPP_INIT_PRIORITY_MAX;