diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:04 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-02-11 12:38:11 +0000 |
| commit | e3b557809604d036af6e00c60f012c2025b59a5e (patch) | |
| tree | 8a11ba2269a3b669601e2fd41145b174008f4da8 /libcxx/include/experimental | |
| parent | 08e8dd7b9db7bb4a9de26d44c1cbfd24e869c014 (diff) | |
Diffstat (limited to 'libcxx/include/experimental')
| -rw-r--r-- | libcxx/include/experimental/__memory | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/coroutine | 31 | ||||
| -rw-r--r-- | libcxx/include/experimental/deque | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/forward_list | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/functional | 50 | ||||
| -rw-r--r-- | libcxx/include/experimental/iterator | 25 | ||||
| -rw-r--r-- | libcxx/include/experimental/list | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/map | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/memory_resource | 50 | ||||
| -rw-r--r-- | libcxx/include/experimental/propagate_const | 7 | ||||
| -rw-r--r-- | libcxx/include/experimental/regex | 12 | ||||
| -rw-r--r-- | libcxx/include/experimental/set | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/simd | 49 | ||||
| -rw-r--r-- | libcxx/include/experimental/string | 16 | ||||
| -rw-r--r-- | libcxx/include/experimental/unordered_map | 20 | ||||
| -rw-r--r-- | libcxx/include/experimental/unordered_set | 4 | ||||
| -rw-r--r-- | libcxx/include/experimental/vector | 4 |
17 files changed, 193 insertions, 99 deletions
diff --git a/libcxx/include/experimental/__memory b/libcxx/include/experimental/__memory index 749cf4c0c657..b36f31eebb7c 100644 --- a/libcxx/include/experimental/__memory +++ b/libcxx/include/experimental/__memory @@ -56,11 +56,11 @@ struct __lfts_uses_alloc_ctor_imp<true, _Tp, _Alloc, _Args...> = is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value; static const bool __ic_second = - conditional< + __conditional_t< __ic_first, false_type, is_constructible<_Tp, _Args..., _Alloc> - >::type::value; + >::value; static_assert(__ic_first || __ic_second, "Request for uses allocator construction is ill-formed"); diff --git a/libcxx/include/experimental/coroutine b/libcxx/include/experimental/coroutine index 111073bb6d67..d9f368535024 100644 --- a/libcxx/include/experimental/coroutine +++ b/libcxx/include/experimental/coroutine @@ -50,10 +50,28 @@ template <class P> struct hash<coroutine_handle<P>>; #include <__functional/operations.h> #include <cstddef> #include <experimental/__config> -#include <memory> // for hash<T*> #include <new> #include <type_traits> +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <climits> +# include <cmath> +# include <compare> +# include <concepts> +# include <ctime> +# include <initializer_list> +# include <iosfwd> +# include <iterator> +# include <memory> +# include <ratio> +# include <stdexcept> +# include <tuple> +# include <typeinfo> +# include <utility> +# include <variant> +#endif + #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -66,8 +84,7 @@ template <class _Tp, class = void> struct __coroutine_traits_sfinae {}; template <class _Tp> -struct __coroutine_traits_sfinae< - _Tp, typename __void_t<typename _Tp::promise_type>::type> +struct __coroutine_traits_sfinae<_Tp, __void_t<typename _Tp::promise_type> > { using promise_type = typename _Tp::promise_type; }; @@ -241,7 +258,7 @@ public: _LIBCPP_INLINE_VISIBILITY static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { - typedef typename remove_cv<_Promise>::type _RawPromise; + typedef __remove_cv_t<_Promise> _RawPromise; coroutine_handle __tmp; __tmp.__handle_ = __builtin_coro_promise( _VSTD::addressof(const_cast<_RawPromise&>(__promise)), @@ -269,9 +286,9 @@ public: _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return true; } _LIBCPP_CONSTEXPR bool done() const _NOEXCEPT { return false; } - _LIBCPP_CONSTEXPR_AFTER_CXX17 void operator()() const _NOEXCEPT {} - _LIBCPP_CONSTEXPR_AFTER_CXX17 void resume() const _NOEXCEPT {} - _LIBCPP_CONSTEXPR_AFTER_CXX17 void destroy() const _NOEXCEPT {} + _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()() const _NOEXCEPT {} + _LIBCPP_CONSTEXPR_SINCE_CXX20 void resume() const _NOEXCEPT {} + _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy() const _NOEXCEPT {} private: _LIBCPP_INLINE_VISIBILITY diff --git a/libcxx/include/experimental/deque b/libcxx/include/experimental/deque index 3e3f9098a8fd..46962afbb795 100644 --- a/libcxx/include/experimental/deque +++ b/libcxx/include/experimental/deque @@ -40,9 +40,13 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _ValueT> 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 index 4b102c554704..5d2686deb276 100644 --- a/libcxx/include/experimental/forward_list +++ b/libcxx/include/experimental/forward_list @@ -40,9 +40,13 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _ValueT> 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/functional b/libcxx/include/experimental/functional index 12440744ca50..cb9a5efac3f8 100644 --- a/libcxx/include/experimental/functional +++ b/libcxx/include/experimental/functional @@ -85,9 +85,9 @@ _LIBCPP_BEGIN_NAMESPACE_LFTS # define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER # define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER #else -# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::exprerimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") +# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") +# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") +# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") #endif #if _LIBCPP_STD_VER > 11 @@ -132,24 +132,24 @@ class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> { typedef _Key key_type; const _Value __default_value_; - std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table; + std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_; public: _LIBCPP_INLINE_VISIBILITY _BMSkipTable(size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred) - : __default_value_(__default), __table(__sz, __hf, __pred) {} + : __default_value_(__default), __table_(__sz, __hf, __pred) {} _LIBCPP_INLINE_VISIBILITY void insert(const key_type &__key, value_type __val) { - __table [__key] = __val; // Would skip_.insert (val) be better here? + __table_ [__key] = __val; // Would skip_.insert (val) be better here? } _LIBCPP_INLINE_VISIBILITY value_type operator [](const key_type & __key) const { - auto __it = __table.find (__key); - return __it == __table.end() ? __default_value_ : __it->second; + auto __it = __table_.find (__key); + return __it == __table_.end() ? __default_value_ : __it->second; } }; @@ -161,27 +161,27 @@ private: typedef _Value value_type; typedef _Key key_type; - typedef typename make_unsigned<key_type>::type unsigned_key_type; + typedef __make_unsigned_t<key_type> unsigned_key_type; typedef std::array<value_type, 256> skip_map; - skip_map __table; + skip_map __table_; public: _LIBCPP_INLINE_VISIBILITY _BMSkipTable(size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/) { - std::fill_n(__table.begin(), __table.size(), __default); + std::fill_n(__table_.begin(), __table_.size(), __default); } _LIBCPP_INLINE_VISIBILITY void insert(key_type __key, value_type __val) { - __table[static_cast<unsigned_key_type>(__key)] = __val; + __table_[static_cast<unsigned_key_type>(__key)] = __val; } _LIBCPP_INLINE_VISIBILITY value_type operator [](key_type __key) const { - return __table[static_cast<unsigned_key_type>(__key)]; + return __table_[static_cast<unsigned_key_type>(__key)]; } }; @@ -205,8 +205,8 @@ public: _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) : __first_(__f), __last_(__l), __pred_(__pred), __pattern_length_(_VSTD::distance(__first_, __last_)), - __skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, - __suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)} + __skip_{std::make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, + __suffix_{std::make_shared<vector<difference_type>>(__pattern_length_ + 1)} { // build the skip table for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) @@ -223,12 +223,12 @@ public: typename iterator_traits<_RandomAccessIterator2>::value_type>::value, "Corpus and Pattern iterators must point to the same type"); - if (__f == __l ) return make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return make_pair(__f, __f); // empty pattern + if (__f == __l ) return std::make_pair(__l, __l); // empty corpus + if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern // If the pattern is larger than the corpus, we can't find it! if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return make_pair(__l, __l); + return std::make_pair(__l, __l); // Do the search return this->__search(__f, __l); @@ -260,7 +260,7 @@ private: __j--; // We matched - we're done! if ( __j == 0 ) - return make_pair(__cur, __cur + __pattern_length_); + return std::make_pair(__cur, __cur + __pattern_length_); } // Since we didn't match, figure out how far to skip forward @@ -272,7 +272,7 @@ private: __cur += __suffix[ __j ]; } - return make_pair(__l, __l); // We didn't find anything + return std::make_pair(__l, __l); // We didn't find anything } @@ -373,12 +373,12 @@ public: typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, "Corpus and Pattern iterators must point to the same type"); - if (__f == __l ) return make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return make_pair(__f, __f); // empty pattern + if (__f == __l ) return std::make_pair(__l, __l); // empty corpus + if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern // If the pattern is larger than the corpus, we can't find it! if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return make_pair(__l, __l); + return std::make_pair(__l, __l); // Do the search return this->__search(__f, __l); @@ -407,12 +407,12 @@ private: __j--; // We matched - we're done! if ( __j == 0 ) - return make_pair(__cur, __cur + __pattern_length_); + return std::make_pair(__cur, __cur + __pattern_length_); } __cur += __skip[__cur[__pattern_length_-1]]; } - return make_pair(__l, __l); + return std::make_pair(__l, __l); } }; diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator index a92bca6a20fa..cf73b74e887e 100644 --- a/libcxx/include/experimental/iterator +++ b/libcxx/include/experimental/iterator @@ -54,6 +54,7 @@ namespace std { #include <__assert> // all public C++ headers provide the assertion handler #include <__memory/addressof.h> +#include <__type_traits/decay.h> #include <__utility/forward.h> #include <__utility/move.h> #include <experimental/__config> @@ -82,19 +83,19 @@ public: typedef void reference; ostream_joiner(ostream_type& __os, _Delim&& __d) - : __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {} + : __output_iter_(_VSTD::addressof(__os)), __delim_(_VSTD::move(__d)), __first_(true) {} ostream_joiner(ostream_type& __os, const _Delim& __d) - : __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {} + : __output_iter_(_VSTD::addressof(__os)), __delim_(__d), __first_(true) {} template<typename _Tp> ostream_joiner& operator=(const _Tp& __v) { - if (!__first) - *__output_iter << __delim; - __first = false; - *__output_iter << __v; + if (!__first_) + *__output_iter_ << __delim_; + __first_ = false; + *__output_iter_ << __v; return *this; } @@ -103,14 +104,14 @@ public: ostream_joiner& operator++(int) _NOEXCEPT { return *this; } private: - ostream_type* __output_iter; - _Delim __delim; - bool __first; + ostream_type* __output_iter_; + _Delim __delim_; + bool __first_; }; template <class _CharT, class _Traits, class _Delim> -ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits> +_LIBCPP_HIDE_FROM_ABI ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits> make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) { return ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } @@ -118,4 +119,8 @@ _LIBCPP_END_NAMESPACE_LFTS #endif // _LIBCPP_STD_VER > 11 +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <type_traits> +#endif + #endif // _LIBCPP_EXPERIMENTAL_ITERATOR diff --git a/libcxx/include/experimental/list b/libcxx/include/experimental/list index c8480575977e..06abe8702241 100644 --- a/libcxx/include/experimental/list +++ b/libcxx/include/experimental/list @@ -40,9 +40,13 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _ValueT> 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 index 3dee7f703aeb..8ec94e4a5bc8 100644 --- a/libcxx/include/experimental/map +++ b/libcxx/include/experimental/map @@ -45,6 +45,8 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _Key, class _Value, class _Compare = less<_Key>> using map = _VSTD::map<_Key, _Value, _Compare, polymorphic_allocator<pair<const _Key, _Value>>>; @@ -53,6 +55,8 @@ template <class _Key, class _Value, class _Compare = less<_Key>> using multimap = _VSTD::multimap<_Key, _Value, _Compare, polymorphic_allocator<pair<const _Key, _Value>>>; +#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 index f7b19aafd40f..f107f109203f 100644 --- a/libcxx/include/experimental/memory_resource +++ b/libcxx/include/experimental/memory_resource @@ -65,16 +65,16 @@ namespace pmr { */ #include <__assert> // all public C++ headers provide the assertion handler -#include <__tuple> +#include <__memory/allocator_traits.h> #include <__utility/move.h> #include <cstddef> #include <cstdlib> #include <experimental/__config> #include <experimental/__memory> #include <limits> -#include <memory> #include <new> #include <stdexcept> +#include <tuple> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -86,6 +86,12 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_LFTS_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 + // Round __s up to next multiple of __a. inline _LIBCPP_INLINE_VISIBILITY size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT @@ -95,7 +101,7 @@ size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT } // 8.5, memory.resource -class _LIBCPP_TYPE_VIS memory_resource +class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("memory_resource") _LIBCPP_TYPE_VIS memory_resource { static const size_t __max_align = _LIBCPP_ALIGNOF(max_align_t); @@ -123,37 +129,37 @@ private: }; // 8.5.4, memory.resource.eq -inline _LIBCPP_INLINE_VISIBILITY +_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); } -inline _LIBCPP_INLINE_VISIBILITY +_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_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("new_delete_resource()") _LIBCPP_FUNC_VIS memory_resource * new_delete_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("null_memory_resource()") _LIBCPP_FUNC_VIS memory_resource * null_memory_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("get_default_resource()") _LIBCPP_FUNC_VIS memory_resource * get_default_resource() _NOEXCEPT; -_LIBCPP_FUNC_VIS +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("set_default_resource()") _LIBCPP_FUNC_VIS 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 _ValueType> -class _LIBCPP_TEMPLATE_VIS polymorphic_allocator +class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("polymorphic_allocator") _LIBCPP_TEMPLATE_VIS polymorphic_allocator { public: typedef _ValueType value_type; @@ -314,6 +320,7 @@ private: // 8.6.4, memory.polymorphic.allocator.eq template <class _Tp, class _Up> +_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 @@ -322,6 +329,7 @@ bool operator==(polymorphic_allocator<_Tp> const & __lhs, } template <class _Tp, class _Up> +_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 @@ -331,6 +339,7 @@ bool operator!=(polymorphic_allocator<_Tp> const & __lhs, // 8.7, memory.resource.adaptor +_LIBCPP_SUPPRESS_DEPRECATED_PUSH // 8.7.1, memory.resource.adaptor.overview template <class _CharAlloc> class _LIBCPP_TEMPLATE_VIS __resource_adaptor_imp @@ -379,7 +388,7 @@ public: // 8.7.3, memory.resource.adaptor.mem private: - virtual void * do_allocate(size_t __bytes, size_t) + void * do_allocate(size_t __bytes, size_t) override { if (__bytes > __max_size()) __throw_bad_array_new_length(); @@ -387,7 +396,7 @@ private: return __alloc_.allocate(__s); } - virtual void do_deallocate(void * __p, size_t __bytes, size_t) + void do_deallocate(void * __p, size_t __bytes, size_t) override { _LIBCPP_ASSERT(__bytes <= __max_size(), "do_deallocate called for size which exceeds the maximum allocation size"); @@ -395,7 +404,7 @@ private: __alloc_.deallocate((_ValueType*)__p, __s); } - virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT { + bool do_is_equal(memory_resource const & __other) const _NOEXCEPT override { __resource_adaptor_imp const * __p = dynamic_cast<__resource_adaptor_imp const *>(&__other); return __p ? __alloc_ == __p->__alloc_ : false; @@ -411,9 +420,24 @@ template <class _Alloc> using resource_adaptor = __resource_adaptor_imp< typename allocator_traits<_Alloc>::template rebind_alloc<char> >; +_LIBCPP_SUPPRESS_DEPRECATED_POP + +#endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <climits> +# include <concepts> +# include <cstring> +# include <ctime> +# include <iterator> +# include <memory> +# include <ratio> +# include <variant> +#endif + #endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */ diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const index 432635668e4e..34e917da5154 100644 --- a/libcxx/include/experimental/propagate_const +++ b/libcxx/include/experimental/propagate_const @@ -109,6 +109,7 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__functional/operations.h> +#include <__fwd/hash.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -138,15 +139,15 @@ template <class _Tp> class propagate_const { public: - typedef remove_reference_t<decltype(*declval<_Tp&>())> element_type; + typedef remove_reference_t<decltype(*std::declval<_Tp&>())> element_type; static_assert(!is_array<_Tp>::value, "Instantiation of propagate_const with an array type is ill-formed."); static_assert(!is_reference<_Tp>::value, "Instantiation of propagate_const with a reference type is ill-formed."); - static_assert(!(is_pointer<_Tp>::value && is_function<typename remove_pointer<_Tp>::type>::value), + static_assert(!(is_pointer<_Tp>::value && is_function<__remove_pointer_t<_Tp> >::value), "Instantiation of propagate_const with a function-pointer type is ill-formed."); - static_assert(!(is_pointer<_Tp>::value && is_same<typename remove_cv<typename remove_pointer<_Tp>::type>::type, void>::value), + static_assert(!(is_pointer<_Tp>::value && is_same<__remove_cv_t<__remove_pointer_t<_Tp> >, void>::value), "Instantiation of propagate_const with a pointer to (possibly cv-qualified) void is ill-formed."); private: diff --git a/libcxx/include/experimental/regex b/libcxx/include/experimental/regex index 4dc2bbae4510..0c871f366dc8 100644 --- a/libcxx/include/experimental/regex +++ b/libcxx/include/experimental/regex @@ -48,18 +48,22 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _BiDirIter> using match_results = _VSTD::match_results<_BiDirIter, polymorphic_allocator<_VSTD::sub_match<_BiDirIter>>>; -typedef match_results<const char*> cmatch; -typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("cmatch") typedef match_results<const char*> cmatch; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("smatch") typedef match_results<_VSTD_LFTS_PMR::string::const_iterator> smatch; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -typedef match_results<const wchar_t*> wcmatch; -typedef match_results<_VSTD_LFTS_PMR::wstring::const_iterator> wsmatch; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("wcmatch") typedef match_results<const wchar_t*> 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 index e2e75e35448b..cd61e6449597 100644 --- a/libcxx/include/experimental/set +++ b/libcxx/include/experimental/set @@ -45,6 +45,8 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _Value, class _Compare = less<_Value>> using set = _VSTD::set<_Value, _Compare, polymorphic_allocator<_Value>>; @@ -53,6 +55,8 @@ template <class _Value, class _Compare = less<_Value>> 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/simd b/libcxx/include/experimental/simd index f77ce59bb269..4ca67d212b23 100644 --- a/libcxx/include/experimental/simd +++ b/libcxx/include/experimental/simd @@ -6,6 +6,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// + #ifndef _LIBCPP_EXPERIMENTAL_SIMD #define _LIBCPP_EXPERIMENTAL_SIMD @@ -656,11 +657,6 @@ public: #include <experimental/__config> #include <tuple> -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -# include <algorithm> -# include <functional> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif @@ -720,12 +716,12 @@ public: #ifndef _LIBCPP_HAS_NO_VECTOR_EXTENSION -constexpr size_t __floor_pow_of_2(size_t __val) { +_LIBCPP_HIDE_FROM_ABI constexpr size_t __floor_pow_of_2(size_t __val) { return ((__val - 1) & __val) == 0 ? __val : __floor_pow_of_2((__val - 1) & __val); } -constexpr size_t __ceil_pow_of_2(size_t __val) { +_LIBCPP_HIDE_FROM_ABI constexpr size_t __ceil_pow_of_2(size_t __val) { return __val == 1 ? 1 : __floor_pow_of_2(__val - 1) << 1; } @@ -913,25 +909,27 @@ public: }; template <class _To, class _From> -constexpr decltype(_To{std::declval<_From>()}, true) +_LIBCPP_HIDE_FROM_ABI constexpr decltype(_To{std::declval<_From>()}, true) __is_non_narrowing_convertible_impl(_From) { return true; } template <class _To> -constexpr bool __is_non_narrowing_convertible_impl(...) { +_LIBCPP_HIDE_FROM_ABI constexpr bool __is_non_narrowing_convertible_impl(...) { return false; } template <class _From, class _To> +_LIBCPP_HIDE_FROM_ABI constexpr typename std::enable_if<std::is_arithmetic<_To>::value && std::is_arithmetic<_From>::value, bool>::type __is_non_narrowing_arithmetic_convertible() { - return __is_non_narrowing_convertible_impl<_To>(_From{}); + return experimental::__is_non_narrowing_convertible_impl<_To>(_From{}); } template <class _From, class _To> +_LIBCPP_HIDE_FROM_ABI constexpr typename std::enable_if<!(std::is_arithmetic<_To>::value && std::is_arithmetic<_From>::value), bool>::type @@ -940,13 +938,13 @@ __is_non_narrowing_arithmetic_convertible() { } template <class _Tp> -constexpr _Tp __variadic_sum() { +_LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum() { return _Tp{}; } template <class _Tp, class _Up, class... _Args> -constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) { - return static_cast<_Tp>(__first) + __variadic_sum<_Tp>(__rest...); +_LIBCPP_HIDE_FROM_ABI constexpr _Tp __variadic_sum(_Up __first, _Args... __rest) { + return static_cast<_Tp>(__first) + experimental::__variadic_sum<_Tp>(__rest...); } template <class _Tp> @@ -955,7 +953,7 @@ struct __nodeduce { }; template <class _Tp> -constexpr bool __vectorizable() { +_LIBCPP_HIDE_FROM_ABI constexpr bool __vectorizable() { return std::is_arithmetic<_Tp>::value && !std::is_const<_Tp>::value && !std::is_volatile<_Tp>::value && !std::is_same<_Tp, bool>::value; } @@ -1060,7 +1058,7 @@ struct simd_size<_Tp, __simd_abi<__kind, _Np>> : std::integral_constant<size_t, _Np> { static_assert( std::is_arithmetic<_Tp>::value && - !std::is_same<typename std::remove_const<_Tp>::type, bool>::value, + !std::is_same<__remove_const_t<_Tp>, bool>::value, "Element type should be vectorizable"); }; @@ -1123,13 +1121,13 @@ struct __simd_cast_traits<simd<_Tp, _NewAbi>> { }; template <class _Tp, class _Up, class _Abi> -auto simd_cast(const simd<_Up, _Abi>& __v) +_LIBCPP_HIDE_FROM_ABI auto simd_cast(const simd<_Up, _Abi>& __v) -> decltype(__simd_cast_traits<_Tp>::__apply(__v)) { return __simd_cast_traits<_Tp>::__apply(__v); } template <class _Tp, class _Up, class _Abi> -auto static_simd_cast(const simd<_Up, _Abi>& __v) +_LIBCPP_HIDE_FROM_ABI auto static_simd_cast(const simd<_Up, _Abi>& __v) -> decltype(__static_simd_cast_traits<_Tp>::__apply(__v)) { return __static_simd_cast_traits<_Tp>::__apply(__v); } @@ -1172,12 +1170,12 @@ array<_SimdType, simd_size<typename _SimdType::value_type, _Abi>::value / split(const simd_mask<typename _SimdType::value_type, _Abi>&); template <class _Tp, class... _Abis> -simd<_Tp, abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>> +simd<_Tp, abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>> concat(const simd<_Tp, _Abis>&...); template <class _Tp, class... _Abis> simd_mask<_Tp, - abi_for_size_t<_Tp, __variadic_sum(simd_size<_Tp, _Abis>::value...)>> + abi_for_size_t<_Tp, experimental::__variadic_sum(simd_size<_Tp, _Abis>::value...)>> concat(const simd_mask<_Tp, _Abis>&...); // reductions [simd.mask.reductions] @@ -1302,7 +1300,7 @@ class const_where_expression { public: const_where_expression(const const_where_expression&) = delete; const_where_expression& operator=(const const_where_expression&) = delete; - typename remove_const<_Tp>::type operator-() const&&; + __remove_const_t<_Tp> operator-() const&&; template <class _Up, class _Flags> void copy_to(_Up*, _Flags) const&&; }; @@ -1369,8 +1367,8 @@ private: __is_non_narrowing_arithmetic_convertible<_Up, _Tp>()) || (!std::is_arithmetic<_Up>::value && std::is_convertible<_Up, _Tp>::value) || - std::is_same<typename std::remove_const<_Up>::type, int>::value || - (std::is_same<typename std::remove_const<_Up>::type, + std::is_same<__remove_const_t<_Up>, int>::value || + (std::is_same<__remove_const_t<_Up>, unsigned int>::value && std::is_unsigned<_Tp>::value); } @@ -1381,7 +1379,7 @@ private: std::integral_constant<size_t, __indicies>())...), bool()) __can_generate(std::index_sequence<__indicies...>) { - return !__variadic_sum<bool>( + return !experimental::__variadic_sum<bool>( !__can_broadcast<decltype(std::declval<_Generator>()( std::integral_constant<size_t, __indicies>()))>()...); } @@ -1579,4 +1577,9 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <algorithm> +# include <functional> +#endif + #endif /* _LIBCPP_EXPERIMENTAL_SIMD */ diff --git a/libcxx/include/experimental/string b/libcxx/include/experimental/string index c795d685d735..4edbf98b5f73 100644 --- a/libcxx/include/experimental/string +++ b/libcxx/include/experimental/string @@ -49,17 +49,25 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + +_LIBCPP_SUPPRESS_DEPRECATED_PUSH + template <class _CharT, class _Traits = char_traits<_CharT>> using basic_string = _VSTD::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; -typedef basic_string<char> string; -typedef basic_string<char16_t> u16string; -typedef basic_string<char32_t> u32string; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("string") typedef basic_string<char> string; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("u16string") typedef basic_string<char16_t> u16string; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("u32string") typedef basic_string<char32_t> u32string; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -typedef basic_string<wchar_t> wstring; +_LIBCPP_DEPCREATED_MEMORY_RESOURCE("wstring") typedef basic_string<wchar_t> 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/unordered_map b/libcxx/include/experimental/unordered_map index 636d31bdc557..d2801822a56f 100644 --- a/libcxx/include/experimental/unordered_map +++ b/libcxx/include/experimental/unordered_map @@ -45,20 +45,14 @@ namespace pmr { #include <experimental/memory_resource> #include <unordered_map> -#ifndef _LIBCPP_REMOVE_TRANSITIVE_INCLUDES -# include <algorithm> -# include <array> -# include <bit> -# include <functional> -# include <vector> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _Key, class _Value, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>> using unordered_map = _VSTD::unordered_map<_Key, _Value, _Hash, _Pred, @@ -69,6 +63,16 @@ template <class _Key, class _Value, using unordered_multimap = _VSTD::unordered_multimap<_Key, _Value, _Hash, _Pred, polymorphic_allocator<pair<const _Key, _Value>>>; +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_END_NAMESPACE_LFTS_PMR +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <algorithm> +# include <array> +# include <bit> +# include <functional> +# include <vector> +#endif + #endif /* _LIBCPP_EXPERIMENTAL_UNORDERED_MAP */ diff --git a/libcxx/include/experimental/unordered_set b/libcxx/include/experimental/unordered_set index 509f3ec1044e..493e3a09ed10 100644 --- a/libcxx/include/experimental/unordered_set +++ b/libcxx/include/experimental/unordered_set @@ -45,6 +45,8 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>> using unordered_set = _VSTD::unordered_set<_Value, _Hash, _Pred, @@ -55,6 +57,8 @@ template <class _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/vector b/libcxx/include/experimental/vector index 97c51c830c4a..2e9d77e41af2 100644 --- a/libcxx/include/experimental/vector +++ b/libcxx/include/experimental/vector @@ -40,9 +40,13 @@ namespace pmr { _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR +#ifndef _LIBCPP_CXX03_LANG + template <class _ValueT> using vector = _VSTD::vector<_ValueT, polymorphic_allocator<_ValueT>>; +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_END_NAMESPACE_LFTS_PMR #endif /* _LIBCPP_EXPERIMENTAL_VECTOR */ |
