[libcxx-commits] [libcxx] [libc++][memory] P1132R8: `out_ptr` - a scalable output pointer abstraction (PR #73618)
Hristo Hristov via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jul 18 04:51:37 PDT 2024
https://github.com/Zingam updated https://github.com/llvm/llvm-project/pull/73618
>From 84770c82152f027588dd744bbfb91ed55377e007 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Sun, 30 Apr 2023 13:17:20 +0300
Subject: [PATCH 01/35] [libc++][memory] P1132R8: out_ptr - a scalable output
pointer abstraction
Differential Revision: https://reviews.llvm.org/D150525
---
libcxx/docs/FeatureTestMacroTable.rst | 2 +-
libcxx/docs/Status/Cxx23Issues.csv | 4 +-
libcxx/docs/Status/Cxx23Papers.csv | 2 +-
libcxx/include/CMakeLists.txt | 2 +
libcxx/include/__memory/allocator_traits.h | 1 -
libcxx/include/__memory/inout_ptr.h | 100 +++++++++
libcxx/include/__memory/out_ptr.h | 97 +++++++++
libcxx/include/__memory/pointer_traits.h | 67 +++++-
libcxx/include/memory | 18 ++
libcxx/include/module.modulemap.in | 2 +
libcxx/include/version | 2 +-
libcxx/modules/std/memory.inc | 10 +-
.../memory.version.compile.pass.cpp | 16 +-
.../version.version.compile.pass.cpp | 16 +-
.../inout.ptr/inout.ptr.compile.pass.cpp | 35 +++
.../adapt/inout.ptr/inout.ptr.pass.cpp | 205 ++++++++++++++++++
.../inout.ptr/inout.ptr.t.compile.pass.cpp | 32 +++
.../adapt/inout.ptr/inout.ptr.t.verify.cpp | 29 +++
.../adapt/inout.ptr/inout.ptr.verify.cpp | 30 +++
.../adapt/out.ptr/out.ptr.compile.pass.cpp | 34 +++
.../smartptr/adapt/out.ptr/out.ptr.pass.cpp | 163 ++++++++++++++
.../adapt/out.ptr/out.ptr.t.compile.pass.cpp | 32 +++
.../adapt/out.ptr/out.ptr.t.verify.cpp | 29 +++
.../smartptr/adapt/out.ptr/out.ptr.verify.cpp | 30 +++
.../test/std/utilities/smartptr/adapt/types.h | 77 +++++++
.../generate_feature_test_macro_components.py | 1 -
26 files changed, 999 insertions(+), 37 deletions(-)
create mode 100644 libcxx/include/__memory/inout_ptr.h
create mode 100644 libcxx/include/__memory/out_ptr.h
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/types.h
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index d09f65b7cadc0..4b2adc70f5174 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -342,7 +342,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_optional`` ``202110L``
--------------------------------------------------- -----------------
- ``__cpp_lib_out_ptr`` *unimplemented*
+ ``__cpp_lib_out_ptr`` ``202106L``
--------------------------------------------------- -----------------
``__cpp_lib_print`` *unimplemented*
--------------------------------------------------- -----------------
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index b24ecc5525a14..e5ad365f9ffb8 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -192,7 +192,7 @@
"`3515 <https://wg21.link/LWG3515>`__","§[stacktrace.basic.nonmem]: ``operator<<`` should be less templatized", "November 2022","","",""
"`3545 <https://wg21.link/LWG3545>`__","``std::pointer_traits`` should be SFINAE-friendly", "November 2022","|Complete|","18.0",""
"`3569 <https://wg21.link/LWG3569>`__","``join_view`` fails to support ranges of ranges with non-default_initializable iterators", "November 2022","","","|ranges|"
-"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","","",""
+"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","|Complete|","17.0",""
"`3597 <https://wg21.link/LWG3597>`__","Unsigned integer types don't model advanceable", "November 2022","","","|ranges|"
"`3600 <https://wg21.link/LWG3600>`__","Making ``istream_iterator`` copy constructor trivial is an ABI break", "November 2022","","",""
"`3629 <https://wg21.link/LWG3629>`__","``make_error_code`` and ``make_error_condition`` are customization points","November 2022","|Complete|","16.0",""
@@ -282,7 +282,7 @@
"`3645 <https://wg21.link/LWG3645>`__","``resize_and_overwrite`` is overspecified to call its callback with lvalues","February 2023","|Complete|","14.0",""
"`3655 <https://wg21.link/LWG3655>`__","The ``INVOKE`` operation and union types","February 2023","|Complete|","18.0",""
"`3723 <https://wg21.link/LWG3723>`__","``priority_queue::push_range`` needs to ``append_range``","February 2023","","","|ranges|"
-"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","","",""
+"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","|Complete|","17.0",""
"`3772 <https://wg21.link/LWG3772>`__","``repeat_view``'s ``piecewise`` constructor is missing Postconditions","February 2023","","","|ranges|"
"`3786 <https://wg21.link/LWG3786>`__","Flat maps' deduction guide needs to default ``Allocator`` to be useful","February 2023","","",""
"`3803 <https://wg21.link/LWG3803>`__","``flat_foo`` constructors taking ``KeyContainer`` lack ``KeyCompare`` parameter","February 2023","","",""
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index 5cc9e488297b9..198b0ab9d390e 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -13,7 +13,7 @@
"","","","","","",""
"`P0401R6 <https://wg21.link/P0401R6>`__","LWG","Providing size feedback in the Allocator interface","June 2021","|Complete|","15.0"
"`P0448R4 <https://wg21.link/P0448R4>`__","LWG","A strstream replacement using span<charT> as buffer","June 2021","",""
-"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","",""
+"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","|Complete|","17.0"
"`P1328R1 <https://wg21.link/P1328R1>`__","LWG","Making std::type_info::operator== constexpr","June 2021","|Complete|","17.0"
"`P1425R4 <https://wg21.link/P1425R4>`__","LWG","Iterators pair constructors for stack and queue","June 2021","|Complete|","14.0","|ranges|"
"`P1518R2 <https://wg21.link/P1518R2>`__","LWG","Stop overconstraining allocators in container deduction guides","June 2021","|Complete|","13.0"
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index d8faf6467b79a..e5a28734ae34b 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -529,6 +529,8 @@ set(files
__memory/concepts.h
__memory/construct_at.h
__memory/destruct_n.h
+ __memory/inout_ptr.h
+ __memory/out_ptr.h
__memory/pointer_traits.h
__memory/ranges_construct_at.h
__memory/ranges_uninitialized_algorithms.h
diff --git a/libcxx/include/__memory/allocator_traits.h b/libcxx/include/__memory/allocator_traits.h
index eea5ee973d37f..ed13cf8a3c278 100644
--- a/libcxx/include/__memory/allocator_traits.h
+++ b/libcxx/include/__memory/allocator_traits.h
@@ -38,7 +38,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> struct NAME<_Tp, __void_t<typename _Tp:: PROPERTY > > : true_type { }
// __pointer
-_LIBCPP_ALLOCATOR_TRAITS_HAS_XXX(__has_pointer, pointer);
template <class _Tp, class _Alloc,
class _RawAlloc = __libcpp_remove_reference_t<_Alloc>,
bool = __has_pointer<_RawAlloc>::value>
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
new file mode 100644
index 0000000000000..c2044a4642cf4
--- /dev/null
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -0,0 +1,100 @@
+// -*- 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___INOUT_PTR_H
+#define _LIBCPP___INOUT_PTR_H
+
+#include <__config>
+#include <__memory/addressof.h>
+#include <__memory/pointer_traits.h>
+#include <__memory/shared_ptr.h>
+#include <__memory/unique_ptr.h>
+#include <__type_traits/is_same.h>
+#include <__type_traits/is_specialization.h>
+#include <__type_traits/is_void.h>
+#include <tuple>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+template <class _Smart, class _Pointer, class... _Args>
+class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
+ static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported");
+
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __s, _Args... __args)
+ : __s_(__s), __a_(std::forward<_Args>(__args)...), __p_([&__s] {
+ if constexpr (is_pointer_v<_Smart>) {
+ return __s;
+ } else {
+ return __s.get();
+ }
+ }()) {
+ if constexpr (requires { __s.release(); }) {
+ __s.release();
+ } else {
+ __s = _Smart();
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() {
+ if (!__p_) {
+ return;
+ }
+
+ using _SP = __pointer_of_or_t<_Smart, _Pointer>;
+ if constexpr (is_pointer_v<_Smart>) {
+ std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
+ std::move(__a_));
+ } else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
+ std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
+ std::move(__a_));
+ } else if constexpr (is_constructible_v<_Smart, _SP, _Args...>) {
+ std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
+ std::move(__a_));
+ } else {
+ static_assert(is_pointer_v<_Smart> || __resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
+ is_constructible_v<_Smart, _SP, _Args...>);
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); }
+
+ _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
+ requires(!is_same_v<_Pointer, void*>)
+ {
+ static_assert(is_pointer_v<_Pointer>);
+
+ return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
+ }
+
+private:
+ _Smart& __s_;
+ tuple<_Args...> __a_;
+ _Pointer __p_;
+};
+
+template <class _Pointer = void, class _Smart, class... _Args>
+_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
+ using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
+ return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>{__s, std::forward<_Args>(__args)...};
+}
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___INOUT_PTR_H
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
new file mode 100644
index 0000000000000..09c77cbafe69e
--- /dev/null
+++ b/libcxx/include/__memory/out_ptr.h
@@ -0,0 +1,97 @@
+// -*- 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___OUT_PTR_H
+#define _LIBCPP___OUT_PTR_H
+
+#include <__config>
+#include <__memory/addressof.h>
+#include <__memory/pointer_traits.h>
+#include <__memory/shared_ptr.h>
+#include <__memory/unique_ptr.h>
+#include <__type_traits/is_specialization.h>
+#include <__type_traits/is_void.h>
+#include <tuple>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+template <class _Tp>
+concept __resettable_adapted_ptr = requires(_Tp __ptr) { __ptr().reset(); };
+
+template <class _Smart, class _Pointer, class... _Args>
+class _LIBCPP_TEMPLATE_VIS out_ptr_t {
+ static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0,
+ "Specialization of std::shared_ptr<> requires a deleter.");
+
+public:
+ _LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __s, _Args... __args)
+ : __s_(__s), __a_(std::forward<_Args>(__args)...), __p_() {
+ using _Ptr = decltype(__s);
+ if constexpr (__resettable_smart_pointer<_Ptr>) {
+ __s_.reset();
+ } else if constexpr (is_constructible_v<_Smart>) {
+ __s_ = _Smart();
+ } else {
+ static_assert(__resettable_smart_pointer<_Ptr> || is_constructible_v<_Smart>);
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI out_ptr_t(const out_ptr_t&) = delete;
+
+ _LIBCPP_HIDE_FROM_ABI ~out_ptr_t() {
+ if (!__p_) {
+ return;
+ }
+
+ using _SP = __pointer_of_or_t<_Smart, _Pointer>;
+ if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
+ std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
+ std::move(__a_));
+ } else if constexpr (is_constructible_v<_Smart, _SP, _Args...>) {
+ std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
+ std::move(__a_));
+ } else {
+ static_assert(__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
+ is_constructible_v<_Smart, _SP, _Args...>);
+ }
+ }
+
+ _LIBCPP_HIDE_FROM_ABI operator _Pointer*() const noexcept { return std::addressof(const_cast<_Pointer&>(__p_)); }
+
+ _LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
+ requires(!is_same_v<_Pointer, void*>)
+ {
+ static_assert(is_pointer_v<_Pointer>);
+
+ return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
+ }
+
+private:
+ _Smart& __s_;
+ tuple<_Args...> __a_;
+ _Pointer __p_ = _Pointer();
+};
+
+template <class _Pointer = void, class _Smart, class... _Args>
+_LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
+ using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
+ return std::out_ptr_t<_Smart, _Ptr, _Args&&...>{__s, std::forward<_Args>(__args)...};
+}
+
+#endif // _LIBCPP_STD_VER >= 23
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP___OUT_PTR_H
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 7617948ed76bd..2be0deb50cb8e 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -15,11 +15,14 @@
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_void.h>
+#include <__type_traits/negation.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
+#include <__utility/forward.h>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -28,11 +31,16 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class = void>
-struct __has_element_type : false_type {};
+// clang-format off
+#define _LIBCPP_CLASS_TRAITS_HAS_XXX(NAME, PROPERTY) \
+ template <class _Tp, class = void> \
+ struct NAME : false_type {}; \
+ template <class _Tp> \
+ struct NAME<_Tp, __void_t<typename _Tp::PROPERTY> > : true_type {}
+// clang-format on
-template <class _Tp>
-struct __has_element_type<_Tp, __void_t<typename _Tp::element_type> > : true_type {};
+_LIBCPP_CLASS_TRAITS_HAS_XXX(__has_pointer, pointer);
+_LIBCPP_CLASS_TRAITS_HAS_XXX(__has_element_type, element_type);
template <class _Ptr, bool = __has_element_type<_Ptr>::value>
struct __pointer_traits_element_type {};
@@ -242,6 +250,57 @@ auto to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)
}
#endif
+#if _LIBCPP_STD_VER >= 23
+
+template <class _Tp>
+struct __pointer_of {};
+
+template <class _Tp>
+ requires(__has_pointer<_Tp>::value)
+struct __pointer_of<_Tp> {
+ using type = typename _Tp::pointer;
+};
+
+template <class _Tp>
+ requires(!__has_pointer<_Tp>::value && __has_element_type<_Tp>::value)
+struct __pointer_of<_Tp> {
+ using type = typename _Tp::element_type*;
+};
+
+template <class _Tp>
+ requires(!__has_pointer<_Tp>::value && !__has_element_type<_Tp>::value &&
+ __has_element_type<pointer_traits<_Tp>>::value)
+struct __pointer_of<_Tp> {
+ using type = typename pointer_traits<_Tp>::element_type*;
+};
+
+template <typename _Tp>
+using __pointer_of_t = typename __pointer_of<_Tp>::type;
+
+template <class _Tp, class _Up>
+struct __pointer_of_or {
+ using type _LIBCPP_NODEBUG = _Up;
+};
+
+template <class _Tp, class _Up>
+ requires requires { typename __pointer_of_t<_Tp>; }
+struct __pointer_of_or<_Tp, _Up> {
+ using type _LIBCPP_NODEBUG = __pointer_of_t<_Tp>;
+};
+
+template <typename _Tp, typename _Up>
+using __pointer_of_or_t = typename __pointer_of_or<_Tp, _Up>::type;
+
+template <class _Smart>
+concept __resettable_smart_pointer = requires(_Smart __s) { __s.reset(); };
+
+template <class _Smart, class _Pointer = void, class... _Args>
+concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p, _Args... __args) {
+ __s.reset(static_cast<__pointer_of_or_t<_Smart, _Pointer>>(__p), std::forward<_Args>(__args)...);
+};
+
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___MEMORY_POINTER_TRAITS_H
diff --git a/libcxx/include/memory b/libcxx/include/memory
index 24ba82f43ddd3..d3ab5f73bf00a 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -910,6 +910,22 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
template<size_t N, class T>
[[nodiscard]] constexpr T* assume_aligned(T* ptr); // since C++20
+// [out.ptr.t], class template out_ptr_t
+template<class Smart, class Pointer, class... Args>
+ class out_ptr_t; // since c++23
+
+// [out.ptr], function template out_ptr
+template<class Pointer = void, class Smart, class... Args>
+ auto out_ptr(Smart& s, Args&&... args); // since c++23
+
+// [inout.ptr.t], class template inout_ptr_t
+template<class Smart, class Pointer, class... Args>
+ class inout_ptr_t; // since c++23
+
+// [inout.ptr], function template inout_ptr
+template<class Pointer = void, class Smart, class... Args>
+ auto inout_ptr(Smart& s, Args&&... args); // since c++23
+
} // std
*/
@@ -928,6 +944,8 @@ template<size_t N, class T>
#include <__memory/compressed_pair.h>
#include <__memory/concepts.h>
#include <__memory/construct_at.h>
+#include <__memory/inout_ptr.h>
+#include <__memory/out_ptr.h>
#include <__memory/pointer_traits.h>
#include <__memory/ranges_construct_at.h>
#include <__memory/ranges_uninitialized_algorithms.h>
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 90ee7fbb2157c..f8a154d254167 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1519,6 +1519,8 @@ module std_private_memory_concepts [system] {
}
module std_private_memory_construct_at [system] { header "__memory/construct_at.h" }
module std_private_memory_destruct_n [system] { header "__memory/destruct_n.h" }
+module std_private_memory_inout_ptr [system] { header "__memory/inout_ptr.h" }
+module std_private_memory_out_ptr [system] { header "__memory/out_ptr.h" }
module std_private_memory_pointer_traits [system] { header "__memory/pointer_traits.h" }
module std_private_memory_ranges_construct_at [system] { header "__memory/ranges_construct_at.h" }
module std_private_memory_ranges_uninitialized_algorithms [system] {
diff --git a/libcxx/include/version b/libcxx/include/version
index e84790b888d33..2203dfd0e6005 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -455,7 +455,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_move_only_function 202110L
# undef __cpp_lib_optional
# define __cpp_lib_optional 202110L
-// # define __cpp_lib_out_ptr 202106L
+# define __cpp_lib_out_ptr 202106L
// # define __cpp_lib_print 202207L
// # define __cpp_lib_ranges_as_const 202207L
# define __cpp_lib_ranges_as_rvalue 202207L
diff --git a/libcxx/modules/std/memory.inc b/libcxx/modules/std/memory.inc
index fba2461732c1b..a02fa2b865f57 100644
--- a/libcxx/modules/std/memory.inc
+++ b/libcxx/modules/std/memory.inc
@@ -177,17 +177,19 @@ export namespace std {
// [util.smartptr.atomic], atomic smart pointers
// using std::atomic;
+#if _LIBCPP_STD_VER >= 23
// [out.ptr.t], class template out_ptr_t
- // using std::out_ptr_t;
+ using std::out_ptr_t;
// [out.ptr], function template out_ptr
- // using std::out_ptr;
+ using std::out_ptr;
// [inout.ptr.t], class template inout_ptr_t
- // using std::inout_ptr_t;
+ using std::inout_ptr_t;
// [inout.ptr], function template inout_ptr
- // using std::inout_ptr;
+ using std::inout_ptr;
+#endif // _LIBCPP_STD_VER >= 23
#ifndef _LIBCPP_HAS_NO_THREADS
// [depr.util.smartptr.shared.atomic]
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
index b1f6c76d84739..c3b37ed35a3ad 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
@@ -485,17 +485,11 @@
# error "__cpp_lib_make_unique should have the value 201304L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++23"
-# endif
-# if __cpp_lib_out_ptr != 202106L
-# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++23"
+# endif
+# if __cpp_lib_out_ptr != 202106L
+# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
# endif
# ifndef __cpp_lib_ranges
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index a995795e305c4..413fca0e79fec 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -5210,17 +5210,11 @@
# error "__cpp_lib_optional should have the value 202110L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++23"
-# endif
-# if __cpp_lib_out_ptr != 202106L
-# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++23"
+# endif
+# if __cpp_lib_out_ptr != 202106L
+# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
# endif
# if !defined(_LIBCPP_VERSION)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
new file mode 100644
index 0000000000000..d2eb8c3a6ac00
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr], function template inout_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto inout_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ auto inoutUPtr1 = std::inout_ptr(uPtr);
+ auto inoutUPtr2 = std::inout_ptr<int*>(uPtr);
+ }
+ {
+ auto deleter = [](auto* p) { delete p; };
+ std::unique_ptr<int, decltype(deleter)> uPtr;
+
+ auto inoutUPtr1 = std::inout_ptr(uPtr, deleter);
+ auto inoutUPtr2 = std::inout_ptr<int*>(uPtr, deleter);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
new file mode 100644
index 0000000000000..ece5628053427
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
@@ -0,0 +1,205 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr.t], class template inout_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class inout_ptr_t; // since c++23
+
+// [inout.ptr], function template inout_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto inout_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <cassert>
+#include <memory>
+
+#include "../types.h"
+
+// Test helpers.
+
+void replace_int_p(int** pp) {
+ assert(**pp == 90);
+ delete *pp;
+ *pp = new int{84};
+}
+
+void replace_int_p_with_nullptr(int** pp) {
+ assert(**pp == 90);
+ delete *pp;
+ *pp = nullptr;
+}
+
+void replace_nullptr_with_int_p(int** pp) {
+ assert(*pp == nullptr);
+ *pp = new int{84};
+}
+
+void replace_int_void_p(void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+ delete static_cast<int*>(*pp);
+ *pp = new int{84};
+}
+
+void replace_int_void_p_with_nullptr(void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+ delete static_cast<int*>(*pp);
+ *pp = nullptr;
+}
+
+void replace_nullptr_with_int_void_p(void** pp) {
+ assert(*pp == nullptr);
+ *pp = new int{84};
+}
+
+void replace_SomeInt_p(SomeInt** pp) {
+ auto si = **pp;
+ assert(si.value == 90);
+ delete static_cast<SomeInt*>(*pp);
+ *pp = new SomeInt{9084};
+}
+
+void replace_SomeInt_void_p(void** pp) {
+ assert(reinterpret_cast<SomeInt*>(*pp)->value == 90);
+ delete static_cast<SomeInt*>(*pp);
+ *pp = reinterpret_cast<void*>(new SomeInt{9084});
+}
+
+// Test `std::inout_ptr()` function.
+
+void test_raw_ptr() {
+ {
+ auto rPtr = new int{90};
+
+ replace_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+ }
+ {
+ int* rPtr = nullptr;
+
+ replace_nullptr_with_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_void_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+ }
+ {
+ int* rPtr = nullptr;
+
+ replace_nullptr_with_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto* rPtr = new SomeInt{90};
+
+ replace_SomeInt_p(std::inout_ptr(rPtr));
+ assert(rPtr->value == 9084);
+ delete rPtr;
+ }
+ {
+ auto* rPtr = new SomeInt{90};
+
+ replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(rPtr));
+ assert(rPtr->value == 9084);
+ delete rPtr;
+ }
+}
+
+void test_unique_ptr() {
+ {
+ auto uPtr = std::make_unique<int>(90);
+
+ replace_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ std::unique_ptr<int> uPtr;
+
+ replace_nullptr_with_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ auto uPtr = std::make_unique<int>(90);
+
+ replace_int_void_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ std::unique_ptr<int> uPtr;
+
+ replace_nullptr_with_int_void_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ replace_SomeInt_p(std::inout_ptr(uPtr));
+ assert(uPtr->value == 9084);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(uPtr));
+ assert(uPtr->value == 9084);
+ }
+}
+
+void test_custom_ptr() {
+ // ConstructiblePtr
+ {
+ ConstructiblePtr<int> cPtr(new int{90});
+
+ replace_int_p(std::inout_ptr(cPtr));
+ assert(cPtr == 84);
+ }
+ // ResettablePtr
+ {
+ ResettablePtr<int> rPtr(new int{90});
+
+ replace_int_p(std::inout_ptr(rPtr));
+ assert(rPtr == 84);
+ }
+ // NonConstructiblePtr
+ {
+ NonConstructiblePtr<int> nPtr;
+ nPtr.reset(new int{90});
+
+ replace_int_p(std::inout_ptr(nPtr));
+ assert(nPtr == 84);
+ }
+}
+
+int main(int, char**) {
+ test_raw_ptr();
+ test_unique_ptr();
+ test_custom_ptr();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp
new file mode 100644
index 0000000000000..18979d014dc01
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr.t], class template inout_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class inout_ptr_t; // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ std::inout_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ }
+ {
+ std::unique_ptr<int> uPtr;
+
+ std::inout_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp
new file mode 100644
index 0000000000000..33cc55520bb40
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr.t], class template inout_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class inout_ptr_t; // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ // `std::inout_ptr<>` does not support `std::shared_ptr<>`.
+ {
+ std::shared_ptr<int> sPtr;
+
+ // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
+ std::inout_ptr_t<std::shared_ptr<int>, int*>{sPtr};
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
new file mode 100644
index 0000000000000..3e23e54378120
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr], function template inout_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto inout_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ // `std::inout_ptr<>` does not support `std::shared_ptr<>`.
+ {
+ std::shared_ptr<int> sPtr;
+
+ // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
+ auto inoutUPtr1 = std::inout_ptr(sPtr);
+ auto inoutUPtr2 = std::inout_ptr<int*>(sPtr);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
new file mode 100644
index 0000000000000..71f78a5bf770a
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr], function template out_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto out_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ auto outUPtr1 = std::out_ptr(uPtr);
+ auto outUPtr2 = std::out_ptr<int*>(uPtr);
+ }
+ {
+ std::shared_ptr<int> sPtr;
+
+ auto outSPtr1 = std::out_ptr(sPtr, [](auto* p) { delete p; });
+ auto outSPtr2 = std::out_ptr<int*>(sPtr, [](auto* p) { delete p; });
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
new file mode 100644
index 0000000000000..2ccf48643c332
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
@@ -0,0 +1,163 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr.t], class template out_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class out_ptr_t; // since c++23
+
+// [out.ptr], function template out_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto out_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <cassert>
+#include <memory>
+
+#include "../types.h"
+
+// Test helpers.
+
+void get_int_p(int** pp) { *pp = new int{84}; }
+
+void get_int_p_nullptr(int** pp) { *pp = nullptr; }
+
+void get_int_void_p(void** pp) { *(reinterpret_cast<int**>(pp)) = new int{84}; }
+
+void get_int_void_p_nullptr(void** pp) { *pp = nullptr; }
+
+void get_SomeInt_p(SomeInt** pp) { *pp = new SomeInt{84}; }
+
+void get_SomeInt_void_p(void** pp) { *pp = reinterpret_cast<int*>(new int{84}); }
+
+// Test `std::out_ptr()` function.
+
+void test_raw_ptr() {
+ {
+ auto n{90};
+ auto rPtr = &n;
+
+ get_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+
+ get_int_p_nullptr(std::out_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+
+ get_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+
+ get_int_void_p_nullptr(std::out_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+ }
+ {
+ SomeInt si{90};
+ auto* rPtr = &si;
+
+ get_SomeInt_p(std::out_ptr(rPtr));
+ assert(rPtr->value == 84);
+ delete rPtr;
+ }
+ {
+ SomeInt si{90};
+ auto* rPtr = &si;
+
+ get_SomeInt_void_p(std::out_ptr<SomeInt*>(rPtr));
+ assert(rPtr->value == 84);
+ delete rPtr;
+ }
+}
+
+void test_shared_ptr() {
+ {
+ auto sPtr = std::make_shared<int>(90);
+
+ get_int_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
+ assert(*sPtr == 84);
+
+ sPtr.reset(new int(90));
+
+ get_int_void_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
+ assert(*sPtr == 84);
+ }
+ {
+ auto sPtr = std::make_shared<SomeInt>(90);
+
+ get_SomeInt_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
+ assert(sPtr->value == 84);
+ }
+ {
+ auto sPtr = std::make_shared<SomeInt>(90);
+
+ get_SomeInt_void_p(std::out_ptr<SomeInt*>(sPtr, [](auto* p) { delete p; }));
+ assert(sPtr->value == 84);
+ }
+}
+
+void test_unique_ptr() {
+ {
+ auto uPtr = std::make_unique<int>(90);
+
+ get_int_p(std::out_ptr(uPtr));
+ assert(*uPtr == 84);
+
+ uPtr.reset(new int{90});
+
+ get_int_void_p(std::out_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ get_SomeInt_p(std::out_ptr(uPtr));
+ assert(uPtr->value == 84);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ get_SomeInt_void_p(std::out_ptr<SomeInt*>(uPtr));
+ assert(uPtr->value == 84);
+ }
+}
+
+void test_custom_ptr() {
+ // ConstructiblePtr
+ {
+ ConstructiblePtr<int> cPtr(new int{90});
+
+ get_int_p(std::out_ptr(cPtr));
+ assert(cPtr == 84);
+ }
+ // ResettablePtr
+ {
+ ResettablePtr<int> rPtr(new int{90});
+
+ get_int_p(std::out_ptr(rPtr));
+ assert(rPtr == 84);
+ }
+ // NonConstructiblePtr
+ {
+ NonConstructiblePtr<int> nPtr;
+ nPtr.reset(new int{90});
+
+ get_int_p(std::out_ptr(nPtr));
+ assert(nPtr == 84);
+ }
+}
+
+int main(int, char**) {
+ test_raw_ptr();
+ test_shared_ptr();
+ test_unique_ptr();
+ test_custom_ptr();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp
new file mode 100644
index 0000000000000..12ad53ac3811e
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp
@@ -0,0 +1,32 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr.t], class template out_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class out_ptr_t; // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ std::out_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ }
+ {
+ std::unique_ptr<int, std::default_delete<int>> uPtr;
+
+ std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>>{uPtr, std::default_delete<int>{}};
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp
new file mode 100644
index 0000000000000..c89007b77ae82
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr.t], class template out_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class out_ptr_t; // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ // `std::out_ptr_t<>` requires `std::shared_ptr<>` with a deleter.
+ {
+ std::shared_ptr<int> sPtr;
+
+ // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ std::out_ptr_t<std::shared_ptr<int>, int*>{sPtr};
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
new file mode 100644
index 0000000000000..f48592059ea0a
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr], function template out_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto out_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <memory>
+
+int main(int, char**) {
+ // `std::out_ptr<>` requires `std::shared_ptr<>` with a deleter.
+ {
+ std::shared_ptr<int> sPtr;
+
+ // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ auto outSPtr1 = std::out_ptr(sPtr);
+ auto outSPtr2 = std::out_ptr<int*>(sPtr);
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
new file mode 100644
index 0000000000000..0e2dad400308d
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -0,0 +1,77 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
+#define TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
+
+#include <type_traits>
+#include <memory>
+
+struct ResetArg {};
+
+// Custom pointer types.
+
+template <typename _Tp>
+struct ConstructiblePtr {
+ using pointer = _Tp*;
+ std::unique_ptr<_Tp> ptr;
+
+ ConstructiblePtr() = default;
+ explicit ConstructiblePtr(_Tp* p) : ptr{p} {}
+
+ auto operator==(_Tp val) { return *ptr == val; }
+
+ auto* get() const { return ptr.get(); }
+
+ void release() { ptr.release(); }
+};
+
+static_assert(std::is_same_v<std::__pointer_of_t< ConstructiblePtr<int>>, int* >);
+static_assert(std::is_constructible_v< ConstructiblePtr<int>, int* >);
+
+template <typename _Tp>
+struct ResettablePtr {
+ using element_type = _Tp;
+ std::unique_ptr<_Tp> ptr;
+
+ explicit ResettablePtr(_Tp* p) : ptr{p} {}
+
+ auto operator*() const { return *ptr; }
+
+ auto operator==(_Tp val) { return *ptr == val; }
+
+ void reset() { ptr.reset(); }
+ void reset(_Tp* p, ResetArg) { ptr.reset(p); }
+
+ auto* get() const { return ptr.get(); }
+
+ void release() { ptr.release(); }
+};
+
+static_assert(std::is_same_v<std::__pointer_of_t< ResettablePtr<int>>, int* >);
+static_assert(std::is_constructible_v< ResettablePtr<int>, int* >);
+
+template <typename _Tp>
+struct NonConstructiblePtr : public ResettablePtr<_Tp> {
+ NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr){};
+
+ void reset(_Tp* p) { ResettablePtr<_Tp>::ptr.reset(p); }
+};
+
+static_assert(std::is_same_v<std::__pointer_of_t< NonConstructiblePtr<int>>, int* >);
+static_assert(!std::is_constructible_v< NonConstructiblePtr<int>, int* >);
+
+// Custom types.
+
+struct SomeInt {
+ int value;
+
+ constexpr explicit SomeInt(int val = 0) : value{val} {}
+};
+
+#endif // TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index 47ee20de0fdc2..9910afa15cff6 100755
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -854,7 +854,6 @@ def add_version_header(tc):
"c++26": 202311, # P2833R2 Freestanding Library: inout expected span
},
"headers": ["memory"],
- "unimplemented": True,
},
{
"name": "__cpp_lib_parallel_algorithm",
>From 4bc779ef33ed55605e502f597b94fff69b9e95f9 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Thu, 30 Nov 2023 09:58:10 +0200
Subject: [PATCH 02/35] [out_ptr] Address review comments + new tests
---
libcxx/docs/FeatureTestMacroTable.rst | 2 +-
libcxx/docs/Status/Cxx23Issues.csv | 4 +-
libcxx/docs/Status/Cxx23Papers.csv | 2 +-
libcxx/docs/Status/Cxx2cIssues.csv | 2 +-
libcxx/include/__memory/inout_ptr.h | 8 ++--
libcxx/include/__memory/out_ptr.h | 2 +-
libcxx/include/__memory/pointer_traits.h | 2 -
libcxx/include/version | 2 +-
.../memory.version.compile.pass.cpp | 16 +++----
.../version.version.compile.pass.cpp | 16 +++----
...le.pass.cpp => inout.ptr.general.pass.cpp} | 4 ++
.../adapt/inout.ptr/inout.ptr.pass.cpp | 4 --
.../adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp | 43 +++++++++++++++++++
...le.pass.cpp => inout.ptr.t.deref.pass.cpp} | 3 ++
.../adapt/inout.ptr/inout.ptr.verify.cpp | 1 +
...pile.pass.cpp => out.ptr.general.pass.cpp} | 4 ++
.../smartptr/adapt/out.ptr/out.ptr.pass.cpp | 4 --
.../adapt/out.ptr/out.ptr.t.ctor.pass.cpp | 41 ++++++++++++++++++
...pile.pass.cpp => out.ptr.t.deref.pass.cpp} | 3 ++
.../smartptr/adapt/out.ptr/out.ptr.verify.cpp | 1 +
20 files changed, 122 insertions(+), 42 deletions(-)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.compile.pass.cpp => inout.ptr.general.pass.cpp} (92%)
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.t.compile.pass.cpp => inout.ptr.t.deref.pass.cpp} (91%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.compile.pass.cpp => out.ptr.general.pass.cpp} (92%)
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.t.compile.pass.cpp => out.ptr.t.deref.pass.cpp} (92%)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 4b2adc70f5174..eb7957c07e307 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -426,7 +426,7 @@ Status
--------------------------------------------------- -----------------
``__cpp_lib_linalg`` *unimplemented*
--------------------------------------------------- -----------------
- ``__cpp_lib_out_ptr`` *unimplemented*
+ ``__cpp_lib_out_ptr`` ``202311L``
--------------------------------------------------- -----------------
``__cpp_lib_ratio`` ``202306L``
--------------------------------------------------- -----------------
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index e5ad365f9ffb8..3e0122706930d 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -192,7 +192,7 @@
"`3515 <https://wg21.link/LWG3515>`__","§[stacktrace.basic.nonmem]: ``operator<<`` should be less templatized", "November 2022","","",""
"`3545 <https://wg21.link/LWG3545>`__","``std::pointer_traits`` should be SFINAE-friendly", "November 2022","|Complete|","18.0",""
"`3569 <https://wg21.link/LWG3569>`__","``join_view`` fails to support ranges of ranges with non-default_initializable iterators", "November 2022","","","|ranges|"
-"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","|Complete|","17.0",""
+"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","|Complete|","18.0",""
"`3597 <https://wg21.link/LWG3597>`__","Unsigned integer types don't model advanceable", "November 2022","","","|ranges|"
"`3600 <https://wg21.link/LWG3600>`__","Making ``istream_iterator`` copy constructor trivial is an ABI break", "November 2022","","",""
"`3629 <https://wg21.link/LWG3629>`__","``make_error_code`` and ``make_error_condition`` are customization points","November 2022","|Complete|","16.0",""
@@ -282,7 +282,7 @@
"`3645 <https://wg21.link/LWG3645>`__","``resize_and_overwrite`` is overspecified to call its callback with lvalues","February 2023","|Complete|","14.0",""
"`3655 <https://wg21.link/LWG3655>`__","The ``INVOKE`` operation and union types","February 2023","|Complete|","18.0",""
"`3723 <https://wg21.link/LWG3723>`__","``priority_queue::push_range`` needs to ``append_range``","February 2023","","","|ranges|"
-"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","|Complete|","17.0",""
+"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","|Complete|","18.0",""
"`3772 <https://wg21.link/LWG3772>`__","``repeat_view``'s ``piecewise`` constructor is missing Postconditions","February 2023","","","|ranges|"
"`3786 <https://wg21.link/LWG3786>`__","Flat maps' deduction guide needs to default ``Allocator`` to be useful","February 2023","","",""
"`3803 <https://wg21.link/LWG3803>`__","``flat_foo`` constructors taking ``KeyContainer`` lack ``KeyCompare`` parameter","February 2023","","",""
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index 198b0ab9d390e..02352837fa4da 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -13,7 +13,7 @@
"","","","","","",""
"`P0401R6 <https://wg21.link/P0401R6>`__","LWG","Providing size feedback in the Allocator interface","June 2021","|Complete|","15.0"
"`P0448R4 <https://wg21.link/P0448R4>`__","LWG","A strstream replacement using span<charT> as buffer","June 2021","",""
-"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","|Complete|","17.0"
+"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","|Complete|","18.0"
"`P1328R1 <https://wg21.link/P1328R1>`__","LWG","Making std::type_info::operator== constexpr","June 2021","|Complete|","17.0"
"`P1425R4 <https://wg21.link/P1425R4>`__","LWG","Iterators pair constructors for stack and queue","June 2021","|Complete|","14.0","|ranges|"
"`P1518R2 <https://wg21.link/P1518R2>`__","LWG","Stop overconstraining allocators in container deduction guides","June 2021","|Complete|","13.0"
diff --git a/libcxx/docs/Status/Cxx2cIssues.csv b/libcxx/docs/Status/Cxx2cIssues.csv
index fe0f13f6e8cb2..1f407e322f891 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -24,7 +24,7 @@
"`3749 <https://wg21.link/LWG3749>`__","``common_iterator`` should handle integer-class difference types","Kona November 2023","","",""
"`3809 <https://wg21.link/LWG3809>`__","Is ``std::subtract_with_carry_engine<uint16_t>`` supposed to work","Kona November 2023","","",""
"`3892 <https://wg21.link/LWG3892>`__","Incorrect formatting of nested ranges and tuples","Kona November 2023","|Complete|","17.0","|format|"
-"`3897 <https://wg21.link/LWG3897>`__","``inout_ptr`` will not update raw pointer to 0","Kona November 2023","","",""
+"`3897 <https://wg21.link/LWG3897>`__","``inout_ptr`` will not update raw pointer to 0","Kona November 2023","|Complete|","18.0",""
"`3946 <https://wg21.link/LWG3946>`__","The definition of ``const_iterator_t`` should be reworked","Kona November 2023","","",""
"`3947 <https://wg21.link/LWG3947>`__","Unexpected constraints on ``adjacent_transform_view::base()``","Kona November 2023","","","|ranges|"
"`3948 <https://wg21.link/LWG3948>`__","``possibly-const-range and as-const-pointer`` should be ``noexcept``","Kona November 2023","","","|ranges|"
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index c2044a4642cf4..f91ecd8baff57 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -51,8 +51,10 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
_LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete;
_LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() {
- if (!__p_) {
- return;
+ if constexpr (!is_pointer_v<_Smart>) {
+ if (!__p_) {
+ return;
+ }
}
using _SP = __pointer_of_or_t<_Smart, _Pointer>;
@@ -90,7 +92,7 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
template <class _Pointer = void, class _Smart, class... _Args>
_LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
- return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>{__s, std::forward<_Args>(__args)...};
+ return std::inout_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 23
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 09c77cbafe69e..eebc18c97fdcd 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -87,7 +87,7 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
template <class _Pointer = void, class _Smart, class... _Args>
_LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
using _Ptr = conditional_t<is_void_v<_Pointer>, __pointer_of_t<_Smart>, _Pointer>;
- return std::out_ptr_t<_Smart, _Ptr, _Args&&...>{__s, std::forward<_Args>(__args)...};
+ return std::out_ptr_t<_Smart, _Ptr, _Args&&...>(__s, std::forward<_Args>(__args)...);
}
#endif // _LIBCPP_STD_VER >= 23
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 2be0deb50cb8e..4e902746e6a35 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -15,11 +15,9 @@
#include <__type_traits/conditional.h>
#include <__type_traits/conjunction.h>
#include <__type_traits/decay.h>
-#include <__type_traits/enable_if.h>
#include <__type_traits/is_class.h>
#include <__type_traits/is_function.h>
#include <__type_traits/is_void.h>
-#include <__type_traits/negation.h>
#include <__type_traits/void_t.h>
#include <__utility/declval.h>
#include <__utility/forward.h>
diff --git a/libcxx/include/version b/libcxx/include/version
index 2203dfd0e6005..079e9f346a917 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -502,7 +502,7 @@ __cpp_lib_within_lifetime 202306L <type_traits>
// # define __cpp_lib_hazard_pointer 202306L
// # define __cpp_lib_linalg 202311L
# undef __cpp_lib_out_ptr
-// # define __cpp_lib_out_ptr 202311L
+# define __cpp_lib_out_ptr 202311L
# define __cpp_lib_ratio 202306L
// # define __cpp_lib_rcu 202306L
// # define __cpp_lib_saturation_arithmetic 202311L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
index c3b37ed35a3ad..f50f1788cc497 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/memory.version.compile.pass.cpp
@@ -616,17 +616,11 @@
# error "__cpp_lib_make_unique should have the value 201304L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++26"
-# endif
-# if __cpp_lib_out_ptr != 202311L
-# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++26"
+# endif
+# if __cpp_lib_out_ptr != 202311L
+# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
# endif
# ifndef __cpp_lib_ranges
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index 413fca0e79fec..272177da0b444 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -6917,17 +6917,11 @@
# error "__cpp_lib_optional should have the value 202110L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++26"
-# endif
-# if __cpp_lib_out_ptr != 202311L
-# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++26"
+# endif
+# if __cpp_lib_out_ptr != 202311L
+# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
# endif
# if !defined(_LIBCPP_VERSION)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
similarity index 92%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
index d2eb8c3a6ac00..1b45d04f7942d 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
@@ -21,14 +21,18 @@ int main(int, char**) {
std::unique_ptr<int> uPtr;
auto inoutUPtr1 = std::inout_ptr(uPtr);
+ (void)inoutUPtr1;
auto inoutUPtr2 = std::inout_ptr<int*>(uPtr);
+ (void)inoutUPtr2;
}
{
auto deleter = [](auto* p) { delete p; };
std::unique_ptr<int, decltype(deleter)> uPtr;
auto inoutUPtr1 = std::inout_ptr(uPtr, deleter);
+ (void)inoutUPtr1;
auto inoutUPtr2 = std::inout_ptr<int*>(uPtr, deleter);
+ (void)inoutUPtr2;
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
index ece5628053427..58f09dc3a9ec3 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
@@ -10,10 +10,6 @@
// <memory>
-// [inout.ptr.t], class template inout_ptr_t
-// template<class Smart, class Pointer, class... Args>
-// class inout_ptr_t; // since c++23
-
// [inout.ptr], function template inout_ptr
// template<class Pointer = void, class Smart, class... Args>
// auto inout_ptr(Smart& s, Args&&... args); // since c++23
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp
new file mode 100644
index 0000000000000..0a21a41539e43
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp
@@ -0,0 +1,43 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [inout.ptr.t], class template inout_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class inout_ptr_t; // since c++23
+
+// explicit inout_ptr_t(Smart&, Args...);
+
+#include <memory>
+
+#include "test_convertible.h"
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ std::inout_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+
+ static_assert(
+ !test_convertible<std::inout_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
+ }
+ {
+ auto deleter = [](auto* p) { delete p; };
+ std::unique_ptr<int, decltype(deleter)> uPtr;
+
+ std::inout_ptr_t<std::unique_ptr<int, decltype(deleter)>, int*>{uPtr};
+
+ static_assert(!test_convertible<std::inout_ptr_t<std::unique_ptr<int, decltype(deleter)>, int*>>(),
+ "This constructor must be explicit");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp
similarity index 91%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp
index 18979d014dc01..86a055a7644e2 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.compile.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp
@@ -14,6 +14,9 @@
// template<class Smart, class Pointer, class... Args>
// class inout_ptr_t; // since c++23
+// operator Pointer*() const noexcept;
+// operator void**() const noexcept;
+
#include <memory>
int main(int, char**) {
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
index 3e23e54378120..eb296767085b7 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
@@ -23,6 +23,7 @@ int main(int, char**) {
// expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
auto inoutUPtr1 = std::inout_ptr(sPtr);
+ // expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::inout_ptr_t<shared_ptr<int>, _Ptr>' (aka 'inout_ptr_t<std::shared_ptr<int>, int *>'}}
auto inoutUPtr2 = std::inout_ptr<int*>(sPtr);
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp
similarity index 92%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp
index 71f78a5bf770a..84bea7248e7a6 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp
@@ -21,13 +21,17 @@ int main(int, char**) {
std::unique_ptr<int> uPtr;
auto outUPtr1 = std::out_ptr(uPtr);
+ (void)outUPtr1;
auto outUPtr2 = std::out_ptr<int*>(uPtr);
+ (void)outUPtr2;
}
{
std::shared_ptr<int> sPtr;
auto outSPtr1 = std::out_ptr(sPtr, [](auto* p) { delete p; });
+ (void)outSPtr1;
auto outSPtr2 = std::out_ptr<int*>(sPtr, [](auto* p) { delete p; });
+ (void)outSPtr2;
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
index 2ccf48643c332..a5189717fad62 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
@@ -10,10 +10,6 @@
// <memory>
-// [out.ptr.t], class template out_ptr_t
-// template<class Smart, class Pointer, class... Args>
-// class out_ptr_t; // since c++23
-
// [out.ptr], function template out_ptr
// template<class Pointer = void, class Smart, class... Args>
// auto out_ptr(Smart& s, Args&&... args); // since c++23
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp
new file mode 100644
index 0000000000000..39604247216e8
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp
@@ -0,0 +1,41 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr.t], class template out_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class out_ptr_t; // since c++23
+
+// explicit out_ptr_t(Smart&, Args...);
+
+#include <memory>
+
+#include "test_convertible.h"
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ std::out_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+
+ static_assert(!test_convertible<std::out_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
+ }
+ {
+ std::unique_ptr<int, std::default_delete<int>> uPtr;
+
+ std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>>{uPtr, std::default_delete<int>{}};
+
+ static_assert(!test_convertible<std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>>>(),
+ "This constructor must be explicit");
+ }
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp
similarity index 92%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp
index 12ad53ac3811e..a0f3af8f87fd7 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.compile.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp
@@ -14,6 +14,9 @@
// template<class Smart, class Pointer, class... Args>
// class out_ptr_t; // since c++23
+// operator Pointer*() const noexcept;
+// operator void**() const noexcept;
+
#include <memory>
int main(int, char**) {
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
index f48592059ea0a..3c51583421e76 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
@@ -23,6 +23,7 @@ int main(int, char**) {
// expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
auto outSPtr1 = std::out_ptr(sPtr);
+ // expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<shared_ptr<int>, _Ptr>' (aka 'out_ptr_t<std::shared_ptr<int>, int *>')}}
auto outSPtr2 = std::out_ptr<int*>(sPtr);
}
>From b23e91a1ca684b8454fe84ff570b7245f52e49d1 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Thu, 30 Nov 2023 15:03:00 +0200
Subject: [PATCH 03/35] [out_ptr] Added tests
---
.../inout.ptr.compile.pass.cpp} | 18 +-
.../inout.ptr/inout.ptr.general.pass.cpp | 184 +++++++++++++++-
.../adapt/inout.ptr/inout.ptr.pass.cpp | 201 ------------------
....pass.cpp => inout.ptr.t.convert.pass.cpp} | 20 +-
...eral.pass.cpp => out.ptr.compile.pass.cpp} | 4 -
.../{out.ptr.pass.cpp => out.ptr.general.cpp} | 0
.../adapt/out.ptr/out.ptr.t.convert.pass.cpp | 58 +++++
7 files changed, 256 insertions(+), 229 deletions(-)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr/out.ptr.t.deref.pass.cpp => inout.ptr/inout.ptr.compile.pass.cpp} (54%)
delete mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.t.deref.pass.cpp => inout.ptr.t.convert.pass.cpp} (55%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.general.pass.cpp => out.ptr.compile.pass.cpp} (92%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.pass.cpp => out.ptr.general.cpp} (100%)
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
similarity index 54%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
index a0f3af8f87fd7..d2eb8c3a6ac00 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.deref.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
@@ -10,12 +10,9 @@
// <memory>
-// [out.ptr.t], class template out_ptr_t
-// template<class Smart, class Pointer, class... Args>
-// class out_ptr_t; // since c++23
-
-// operator Pointer*() const noexcept;
-// operator void**() const noexcept;
+// [inout.ptr], function template inout_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto inout_ptr(Smart& s, Args&&... args); // since c++23
#include <memory>
@@ -23,12 +20,15 @@ int main(int, char**) {
{
std::unique_ptr<int> uPtr;
- std::out_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ auto inoutUPtr1 = std::inout_ptr(uPtr);
+ auto inoutUPtr2 = std::inout_ptr<int*>(uPtr);
}
{
- std::unique_ptr<int, std::default_delete<int>> uPtr;
+ auto deleter = [](auto* p) { delete p; };
+ std::unique_ptr<int, decltype(deleter)> uPtr;
- std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>>{uPtr, std::default_delete<int>{}};
+ auto inoutUPtr1 = std::inout_ptr(uPtr, deleter);
+ auto inoutUPtr2 = std::inout_ptr<int*>(uPtr, deleter);
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
index 1b45d04f7942d..58f09dc3a9ec3 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
@@ -14,26 +14,188 @@
// template<class Pointer = void, class Smart, class... Args>
// auto inout_ptr(Smart& s, Args&&... args); // since c++23
+#include <cassert>
#include <memory>
-int main(int, char**) {
+#include "../types.h"
+
+// Test helpers.
+
+void replace_int_p(int** pp) {
+ assert(**pp == 90);
+ delete *pp;
+ *pp = new int{84};
+}
+
+void replace_int_p_with_nullptr(int** pp) {
+ assert(**pp == 90);
+ delete *pp;
+ *pp = nullptr;
+}
+
+void replace_nullptr_with_int_p(int** pp) {
+ assert(*pp == nullptr);
+ *pp = new int{84};
+}
+
+void replace_int_void_p(void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+ delete static_cast<int*>(*pp);
+ *pp = new int{84};
+}
+
+void replace_int_void_p_with_nullptr(void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+ delete static_cast<int*>(*pp);
+ *pp = nullptr;
+}
+
+void replace_nullptr_with_int_void_p(void** pp) {
+ assert(*pp == nullptr);
+ *pp = new int{84};
+}
+
+void replace_SomeInt_p(SomeInt** pp) {
+ auto si = **pp;
+ assert(si.value == 90);
+ delete static_cast<SomeInt*>(*pp);
+ *pp = new SomeInt{9084};
+}
+
+void replace_SomeInt_void_p(void** pp) {
+ assert(reinterpret_cast<SomeInt*>(*pp)->value == 90);
+ delete static_cast<SomeInt*>(*pp);
+ *pp = reinterpret_cast<void*>(new SomeInt{9084});
+}
+
+// Test `std::inout_ptr()` function.
+
+void test_raw_ptr() {
+ {
+ auto rPtr = new int{90};
+
+ replace_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+ }
+ {
+ int* rPtr = nullptr;
+
+ replace_nullptr_with_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto rPtr = new int{90};
+
+ replace_int_void_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+ }
+ {
+ int* rPtr = nullptr;
+
+ replace_nullptr_with_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+ delete rPtr;
+ }
+ {
+ auto* rPtr = new SomeInt{90};
+
+ replace_SomeInt_p(std::inout_ptr(rPtr));
+ assert(rPtr->value == 9084);
+ delete rPtr;
+ }
+ {
+ auto* rPtr = new SomeInt{90};
+
+ replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(rPtr));
+ assert(rPtr->value == 9084);
+ delete rPtr;
+ }
+}
+
+void test_unique_ptr() {
+ {
+ auto uPtr = std::make_unique<int>(90);
+
+ replace_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
{
std::unique_ptr<int> uPtr;
- auto inoutUPtr1 = std::inout_ptr(uPtr);
- (void)inoutUPtr1;
- auto inoutUPtr2 = std::inout_ptr<int*>(uPtr);
- (void)inoutUPtr2;
+ replace_nullptr_with_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
}
{
- auto deleter = [](auto* p) { delete p; };
- std::unique_ptr<int, decltype(deleter)> uPtr;
+ auto uPtr = std::make_unique<int>(90);
- auto inoutUPtr1 = std::inout_ptr(uPtr, deleter);
- (void)inoutUPtr1;
- auto inoutUPtr2 = std::inout_ptr<int*>(uPtr, deleter);
- (void)inoutUPtr2;
+ replace_int_void_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
}
+ {
+ std::unique_ptr<int> uPtr;
+
+ replace_nullptr_with_int_void_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ replace_SomeInt_p(std::inout_ptr(uPtr));
+ assert(uPtr->value == 9084);
+ }
+ {
+ auto uPtr = std::make_unique<SomeInt>(90);
+
+ replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(uPtr));
+ assert(uPtr->value == 9084);
+ }
+}
+
+void test_custom_ptr() {
+ // ConstructiblePtr
+ {
+ ConstructiblePtr<int> cPtr(new int{90});
+
+ replace_int_p(std::inout_ptr(cPtr));
+ assert(cPtr == 84);
+ }
+ // ResettablePtr
+ {
+ ResettablePtr<int> rPtr(new int{90});
+
+ replace_int_p(std::inout_ptr(rPtr));
+ assert(rPtr == 84);
+ }
+ // NonConstructiblePtr
+ {
+ NonConstructiblePtr<int> nPtr;
+ nPtr.reset(new int{90});
+
+ replace_int_p(std::inout_ptr(nPtr));
+ assert(nPtr == 84);
+ }
+}
+
+int main(int, char**) {
+ test_raw_ptr();
+ test_unique_ptr();
+ test_custom_ptr();
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
deleted file mode 100644
index 58f09dc3a9ec3..0000000000000
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.pass.cpp
+++ /dev/null
@@ -1,201 +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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-
-// <memory>
-
-// [inout.ptr], function template inout_ptr
-// template<class Pointer = void, class Smart, class... Args>
-// auto inout_ptr(Smart& s, Args&&... args); // since c++23
-
-#include <cassert>
-#include <memory>
-
-#include "../types.h"
-
-// Test helpers.
-
-void replace_int_p(int** pp) {
- assert(**pp == 90);
- delete *pp;
- *pp = new int{84};
-}
-
-void replace_int_p_with_nullptr(int** pp) {
- assert(**pp == 90);
- delete *pp;
- *pp = nullptr;
-}
-
-void replace_nullptr_with_int_p(int** pp) {
- assert(*pp == nullptr);
- *pp = new int{84};
-}
-
-void replace_int_void_p(void** pp) {
- assert(*(static_cast<int*>(*pp)) == 90);
- delete static_cast<int*>(*pp);
- *pp = new int{84};
-}
-
-void replace_int_void_p_with_nullptr(void** pp) {
- assert(*(static_cast<int*>(*pp)) == 90);
- delete static_cast<int*>(*pp);
- *pp = nullptr;
-}
-
-void replace_nullptr_with_int_void_p(void** pp) {
- assert(*pp == nullptr);
- *pp = new int{84};
-}
-
-void replace_SomeInt_p(SomeInt** pp) {
- auto si = **pp;
- assert(si.value == 90);
- delete static_cast<SomeInt*>(*pp);
- *pp = new SomeInt{9084};
-}
-
-void replace_SomeInt_void_p(void** pp) {
- assert(reinterpret_cast<SomeInt*>(*pp)->value == 90);
- delete static_cast<SomeInt*>(*pp);
- *pp = reinterpret_cast<void*>(new SomeInt{9084});
-}
-
-// Test `std::inout_ptr()` function.
-
-void test_raw_ptr() {
- {
- auto rPtr = new int{90};
-
- replace_int_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
-
- delete rPtr;
- }
- {
- auto rPtr = new int{90};
-
- replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
- }
- {
- int* rPtr = nullptr;
-
- replace_nullptr_with_int_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
- }
- {
- auto rPtr = new int{90};
-
- replace_int_void_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
- }
- {
- auto rPtr = new int{90};
-
- replace_int_void_p_with_nullptr(std::inout_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
- }
- {
- int* rPtr = nullptr;
-
- replace_nullptr_with_int_void_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
- }
- {
- auto* rPtr = new SomeInt{90};
-
- replace_SomeInt_p(std::inout_ptr(rPtr));
- assert(rPtr->value == 9084);
- delete rPtr;
- }
- {
- auto* rPtr = new SomeInt{90};
-
- replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(rPtr));
- assert(rPtr->value == 9084);
- delete rPtr;
- }
-}
-
-void test_unique_ptr() {
- {
- auto uPtr = std::make_unique<int>(90);
-
- replace_int_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
- }
- {
- std::unique_ptr<int> uPtr;
-
- replace_nullptr_with_int_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
- }
- {
- auto uPtr = std::make_unique<int>(90);
-
- replace_int_void_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
- }
- {
- std::unique_ptr<int> uPtr;
-
- replace_nullptr_with_int_void_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
- }
- {
- auto uPtr = std::make_unique<SomeInt>(90);
-
- replace_SomeInt_p(std::inout_ptr(uPtr));
- assert(uPtr->value == 9084);
- }
- {
- auto uPtr = std::make_unique<SomeInt>(90);
-
- replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(uPtr));
- assert(uPtr->value == 9084);
- }
-}
-
-void test_custom_ptr() {
- // ConstructiblePtr
- {
- ConstructiblePtr<int> cPtr(new int{90});
-
- replace_int_p(std::inout_ptr(cPtr));
- assert(cPtr == 84);
- }
- // ResettablePtr
- {
- ResettablePtr<int> rPtr(new int{90});
-
- replace_int_p(std::inout_ptr(rPtr));
- assert(rPtr == 84);
- }
- // NonConstructiblePtr
- {
- NonConstructiblePtr<int> nPtr;
- nPtr.reset(new int{90});
-
- replace_int_p(std::inout_ptr(nPtr));
- assert(nPtr == 84);
- }
-}
-
-int main(int, char**) {
- test_raw_ptr();
- test_unique_ptr();
- test_custom_ptr();
-
- return 0;
-}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.convert.pass.cpp
similarity index 55%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.convert.pass.cpp
index 86a055a7644e2..cee19c11c78c3 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.deref.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.convert.pass.cpp
@@ -17,18 +17,30 @@
// operator Pointer*() const noexcept;
// operator void**() const noexcept;
+#include <cassert>
+#include <concepts>
#include <memory>
int main(int, char**) {
{
- std::unique_ptr<int> uPtr;
+ std::unique_ptr<int> uPtr = std::make_unique<int>(84);
- std::inout_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ const std::inout_ptr_t<std::unique_ptr<int>, int*> ioPtr{uPtr};
+
+ static_assert(noexcept(ioPtr.operator int**()));
+ std::same_as<int**> decltype(auto) pPtr = ioPtr.operator int**();
+
+ assert(**pPtr == 84);
}
{
- std::unique_ptr<int> uPtr;
+ std::unique_ptr<int> uPtr = std::make_unique<int>(84);
+
+ const std::inout_ptr_t<std::unique_ptr<int>, void*> ioPtr{uPtr};
+
+ static_assert(noexcept(ioPtr.operator void**()));
+ std::same_as<void**> decltype(auto) pPtr = ioPtr.operator void**();
- std::inout_ptr_t<std::unique_ptr<int>, int*>{uPtr};
+ assert(**reinterpret_cast<int**>(pPtr) == 84);
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
similarity index 92%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
index 84bea7248e7a6..71f78a5bf770a 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
@@ -21,17 +21,13 @@ int main(int, char**) {
std::unique_ptr<int> uPtr;
auto outUPtr1 = std::out_ptr(uPtr);
- (void)outUPtr1;
auto outUPtr2 = std::out_ptr<int*>(uPtr);
- (void)outUPtr2;
}
{
std::shared_ptr<int> sPtr;
auto outSPtr1 = std::out_ptr(sPtr, [](auto* p) { delete p; });
- (void)outSPtr1;
auto outSPtr2 = std::out_ptr<int*>(sPtr, [](auto* p) { delete p; });
- (void)outSPtr2;
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp
new file mode 100644
index 0000000000000..1e19d1ee5b4ec
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp
@@ -0,0 +1,58 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr.t], class template out_ptr_t
+// template<class Smart, class Pointer, class... Args>
+// class out_ptr_t; // since c++23
+
+// operator Pointer*() const noexcept;
+// operator void**() const noexcept;
+
+#include <cassert>
+#include <concepts>
+#include <memory>
+#include <iostream>
+
+int main(int, char**) {
+ {
+ std::unique_ptr<int> uPtr;
+
+ const std::out_ptr_t<std::unique_ptr<int>, int*> oPtr{uPtr};
+
+ static_assert(noexcept(oPtr.operator int**()));
+ std::same_as<int**> decltype(auto) pPtr = oPtr.operator int**();
+
+ assert(*pPtr == nullptr);
+ }
+ {
+ std::unique_ptr<int, std::default_delete<int>> uPtr;
+
+ const std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>> oPtr{uPtr, std::default_delete<int>{}};
+
+ static_assert(noexcept(oPtr.operator int**()));
+ std::same_as<int**> decltype(auto) pPtr = oPtr.operator int**();
+
+ assert(*pPtr == nullptr);
+ }
+ {
+ std::unique_ptr<int> uPtr;
+
+ const std::out_ptr_t<std::unique_ptr<int>, void*> oPtr{uPtr};
+
+ static_assert(noexcept(oPtr.operator void**()));
+ std::same_as<void**> decltype(auto) pPtr = oPtr.operator void**();
+
+ assert(*pPtr == nullptr);
+ }
+
+ return 0;
+}
>From cb71ea2e2942a85b85712a877f994b6189efd83b Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Thu, 30 Nov 2023 15:04:52 +0200
Subject: [PATCH 04/35] Removed tests files
---
.../inout.ptr/inout.ptr.compile.pass.cpp | 35 -------------------
.../adapt/out.ptr/out.ptr.compile.pass.cpp | 34 ------------------
2 files changed, 69 deletions(-)
delete mode 100644 libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
delete mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
deleted file mode 100644
index d2eb8c3a6ac00..0000000000000
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.compile.pass.cpp
+++ /dev/null
@@ -1,35 +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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-
-// <memory>
-
-// [inout.ptr], function template inout_ptr
-// template<class Pointer = void, class Smart, class... Args>
-// auto inout_ptr(Smart& s, Args&&... args); // since c++23
-
-#include <memory>
-
-int main(int, char**) {
- {
- std::unique_ptr<int> uPtr;
-
- auto inoutUPtr1 = std::inout_ptr(uPtr);
- auto inoutUPtr2 = std::inout_ptr<int*>(uPtr);
- }
- {
- auto deleter = [](auto* p) { delete p; };
- std::unique_ptr<int, decltype(deleter)> uPtr;
-
- auto inoutUPtr1 = std::inout_ptr(uPtr, deleter);
- auto inoutUPtr2 = std::inout_ptr<int*>(uPtr, deleter);
- }
-
- return 0;
-}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
deleted file mode 100644
index 71f78a5bf770a..0000000000000
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.compile.pass.cpp
+++ /dev/null
@@ -1,34 +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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-
-// <memory>
-
-// [out.ptr], function template out_ptr
-// template<class Pointer = void, class Smart, class... Args>
-// auto out_ptr(Smart& s, Args&&... args); // since c++23
-
-#include <memory>
-
-int main(int, char**) {
- {
- std::unique_ptr<int> uPtr;
-
- auto outUPtr1 = std::out_ptr(uPtr);
- auto outUPtr2 = std::out_ptr<int*>(uPtr);
- }
- {
- std::shared_ptr<int> sPtr;
-
- auto outSPtr1 = std::out_ptr(sPtr, [](auto* p) { delete p; });
- auto outSPtr2 = std::out_ptr<int*>(sPtr, [](auto* p) { delete p; });
- }
-
- return 0;
-}
>From d9e04a741ae92ff7916910ca6afd764eab610d63 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Thu, 14 Dec 2023 20:53:43 +0200
Subject: [PATCH 05/35] Addressed comments: Renamed test files
---
.../{inout.ptr.general.pass.cpp => inout_ptr.general.pass.cpp} | 0
.../inout.ptr/{inout.ptr.verify.cpp => inout_ptr.verify.cpp} | 0
...{inout.ptr.t.convert.pass.cpp => inout_ptr_t.convert.pass.cpp} | 0
.../{inout.ptr.t.ctor.pass.cpp => inout_ptr_t.ctor.pass.cpp} | 0
.../inout.ptr/{inout.ptr.t.verify.cpp => inout_ptr_t.verify.cpp} | 0
.../adapt/out.ptr/{out.ptr.general.cpp => out_ptr.general.cpp} | 0
.../adapt/out.ptr/{out.ptr.verify.cpp => out_ptr.verify.cpp} | 0
.../{out.ptr.t.convert.pass.cpp => out_ptr_t.convert.pass.cpp} | 0
.../out.ptr/{out.ptr.t.ctor.pass.cpp => out_ptr_t.ctor.pass.cpp} | 0
.../adapt/out.ptr/{out.ptr.t.verify.cpp => out_ptr_t.verify.cpp} | 0
10 files changed, 0 insertions(+), 0 deletions(-)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.general.pass.cpp => inout_ptr.general.pass.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.verify.cpp => inout_ptr.verify.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.t.convert.pass.cpp => inout_ptr_t.convert.pass.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.t.ctor.pass.cpp => inout_ptr_t.ctor.pass.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/inout.ptr/{inout.ptr.t.verify.cpp => inout_ptr_t.verify.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.general.cpp => out_ptr.general.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.verify.cpp => out_ptr.verify.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.t.convert.pass.cpp => out_ptr_t.convert.pass.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.t.ctor.pass.cpp => out_ptr_t.ctor.pass.cpp} (100%)
rename libcxx/test/std/utilities/smartptr/adapt/out.ptr/{out.ptr.t.verify.cpp => out_ptr_t.verify.cpp} (100%)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.general.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.convert.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.convert.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.convert.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.ctor.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.ctor.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.ctor.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout.ptr.t.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.general.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.convert.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.convert.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.convert.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.ctor.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.ctor.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.ctor.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out.ptr.t.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.verify.cpp
>From 3405ee5a7c5d5e367f6c533c033600d20bb959d7 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Fri, 15 Dec 2023 10:05:17 +0200
Subject: [PATCH 06/35] Addressed comments: Renamed ctr args
---
libcxx/include/__memory/inout_ptr.h | 14 +++++++-------
libcxx/include/__memory/out_ptr.h | 6 +++---
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index f91ecd8baff57..18157b271cd75 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -33,18 +33,18 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported");
public:
- _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __s, _Args... __args)
- : __s_(__s), __a_(std::forward<_Args>(__args)...), __p_([&__s] {
+ _LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __smart, _Args... __args)
+ : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_([&__smart] {
if constexpr (is_pointer_v<_Smart>) {
- return __s;
+ return __smart;
} else {
- return __s.get();
+ return __smart.get();
}
}()) {
- if constexpr (requires { __s.release(); }) {
- __s.release();
+ if constexpr (requires { __s_.release(); }) {
+ __s_.release();
} else {
- __s = _Smart();
+ __s_ = _Smart();
}
}
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index eebc18c97fdcd..6d3dd4b588dab 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -36,9 +36,9 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
"Specialization of std::shared_ptr<> requires a deleter.");
public:
- _LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __s, _Args... __args)
- : __s_(__s), __a_(std::forward<_Args>(__args)...), __p_() {
- using _Ptr = decltype(__s);
+ _LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __smart, _Args... __args)
+ : __s_(__smart), __a_(std::forward<_Args>(__args)...), __p_() {
+ using _Ptr = decltype(__smart);
if constexpr (__resettable_smart_pointer<_Ptr>) {
__s_.reset();
} else if constexpr (is_constructible_v<_Smart>) {
>From 2b2aaec9aaac7ae7a764e2639f34a1bb3d7412fd Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Fri, 15 Dec 2023 18:54:24 +0200
Subject: [PATCH 07/35] Addressed comments: Refactored tests
---
libcxx/include/__memory/out_ptr.h | 2 +
libcxx/include/__memory/pointer_traits.h | 2 +-
.../inout.ptr/inout_ptr.general.pass.cpp | 218 ++++++++----------
.../adapt/out.ptr/out_ptr.general.cpp | 159 -------------
.../adapt/out.ptr/out_ptr.general.pass.cpp | 212 +++++++++++++++++
.../smartptr/adapt/out.ptr/out_ptr.verify.cpp | 21 ++
.../test/std/utilities/smartptr/adapt/types.h | 23 ++
7 files changed, 360 insertions(+), 277 deletions(-)
delete mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp
create mode 100644 libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 6d3dd4b588dab..618fc372bd965 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -63,6 +63,8 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else {
+ // static_assert(__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>);
+ // static_assert(is_constructible_v<_Smart, _SP, _Args...>);
static_assert(__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
is_constructible_v<_Smart, _SP, _Args...>);
}
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 4e902746e6a35..bf486c6ddbb17 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -292,7 +292,7 @@ using __pointer_of_or_t = typename __pointer_of_or<_Tp, _Up>::type;
template <class _Smart>
concept __resettable_smart_pointer = requires(_Smart __s) { __s.reset(); };
-template <class _Smart, class _Pointer = void, class... _Args>
+template <class _Smart, class _Pointer, class... _Args>
concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p, _Args... __args) {
__s.reset(static_cast<__pointer_of_or_t<_Smart, _Pointer>>(__p), std::forward<_Args>(__args)...);
};
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
index 58f09dc3a9ec3..4114ab6ee7549 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
@@ -19,58 +19,15 @@
#include "../types.h"
-// Test helpers.
+void test_replace_int_p() {
+ auto replace_int_p = [](int** pp) {
+ assert(**pp == 90);
-void replace_int_p(int** pp) {
- assert(**pp == 90);
- delete *pp;
- *pp = new int{84};
-}
-
-void replace_int_p_with_nullptr(int** pp) {
- assert(**pp == 90);
- delete *pp;
- *pp = nullptr;
-}
-
-void replace_nullptr_with_int_p(int** pp) {
- assert(*pp == nullptr);
- *pp = new int{84};
-}
-
-void replace_int_void_p(void** pp) {
- assert(*(static_cast<int*>(*pp)) == 90);
- delete static_cast<int*>(*pp);
- *pp = new int{84};
-}
-
-void replace_int_void_p_with_nullptr(void** pp) {
- assert(*(static_cast<int*>(*pp)) == 90);
- delete static_cast<int*>(*pp);
- *pp = nullptr;
-}
-
-void replace_nullptr_with_int_void_p(void** pp) {
- assert(*pp == nullptr);
- *pp = new int{84};
-}
-
-void replace_SomeInt_p(SomeInt** pp) {
- auto si = **pp;
- assert(si.value == 90);
- delete static_cast<SomeInt*>(*pp);
- *pp = new SomeInt{9084};
-}
-
-void replace_SomeInt_void_p(void** pp) {
- assert(reinterpret_cast<SomeInt*>(*pp)->value == 90);
- delete static_cast<SomeInt*>(*pp);
- *pp = reinterpret_cast<void*>(new SomeInt{9084});
-}
-
-// Test `std::inout_ptr()` function.
+ delete *pp;
+ *pp = new int{84};
+ };
-void test_raw_ptr() {
+ // raw pointer
{
auto rPtr = new int{90};
@@ -79,123 +36,150 @@ void test_raw_ptr() {
delete rPtr;
}
- {
- auto rPtr = new int{90};
- replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
- }
+ // std::unique_ptr
{
- int* rPtr = nullptr;
+ auto uPtr = std::make_unique<int>(90);
- replace_nullptr_with_int_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
+ replace_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
}
- {
- auto rPtr = new int{90};
- replace_int_void_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
- }
+ // pointer-like ConstructiblePtr
{
- auto rPtr = new int{90};
+ ConstructiblePtr<int> cPtr(new int{90});
- replace_int_void_p_with_nullptr(std::inout_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
+ replace_int_p(std::inout_ptr(cPtr));
+ assert(cPtr == 84);
}
+
+ // pointer-like ResettablePtr
{
- int* rPtr = nullptr;
+ ResettablePtr<int> rPtr(new int{90});
- replace_nullptr_with_int_void_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
+ replace_int_p(std::inout_ptr(rPtr));
+ assert(rPtr == 84);
}
+
+ // pointer-like NonConstructiblePtr
{
- auto* rPtr = new SomeInt{90};
+ NonConstructiblePtr<int> nPtr;
+ nPtr.reset(new int{90});
- replace_SomeInt_p(std::inout_ptr(rPtr));
- assert(rPtr->value == 9084);
- delete rPtr;
+ replace_int_p(std::inout_ptr(nPtr));
+ assert(nPtr == 84);
}
+}
+
+void test_replace_int_p_with_nullptr() {
+ auto replace_int_p_with_nullptr = [](int** pp) -> void {
+ assert(**pp == 90);
+
+ delete *pp;
+ *pp = nullptr;
+ };
+
+ // raw pointer
{
- auto* rPtr = new SomeInt{90};
+ auto rPtr = new int{90};
- replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(rPtr));
- assert(rPtr->value == 9084);
- delete rPtr;
+ replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
}
-}
-void test_unique_ptr() {
+ // std::unique_ptr
{
auto uPtr = std::make_unique<int>(90);
- replace_int_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
+ replace_int_p_with_nullptr(std::inout_ptr(uPtr));
+ assert(uPtr == nullptr);
}
+}
+
+void test_replace_int_void_p() {
+ auto replace_int_void_p = [](void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+
+ delete static_cast<int*>(*pp);
+ *pp = new int{84};
+ };
+
+ // raw pointer
{
- std::unique_ptr<int> uPtr;
+ auto rPtr = new int{90};
- replace_nullptr_with_int_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
+ replace_int_void_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
}
+
+ // std::unique_ptr
{
auto uPtr = std::make_unique<int>(90);
replace_int_void_p(std::inout_ptr(uPtr));
assert(*uPtr == 84);
}
- {
- std::unique_ptr<int> uPtr;
+}
- replace_nullptr_with_int_void_p(std::inout_ptr(uPtr));
- assert(*uPtr == 84);
- }
+void test_replace_int_void_p_with_nullptr() {
+ auto replace_int_void_p_with_nullptr = [](void** pp) {
+ assert(*(static_cast<int*>(*pp)) == 90);
+
+ delete static_cast<int*>(*pp);
+ *pp = nullptr;
+ };
+
+ // raw pointer
{
- auto uPtr = std::make_unique<SomeInt>(90);
+ auto rPtr = new int{90};
- replace_SomeInt_p(std::inout_ptr(uPtr));
- assert(uPtr->value == 9084);
+ replace_int_void_p_with_nullptr(std::inout_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
}
+
+ // std::unique_ptr
{
- auto uPtr = std::make_unique<SomeInt>(90);
+ auto uPtr = std::make_unique<int>(90);
- replace_SomeInt_void_p(std::inout_ptr<SomeInt*>(uPtr));
- assert(uPtr->value == 9084);
+ replace_int_void_p_with_nullptr(std::inout_ptr(uPtr));
+ assert(uPtr == nullptr);
}
}
-void test_custom_ptr() {
- // ConstructiblePtr
- {
- ConstructiblePtr<int> cPtr(new int{90});
+void test_replace_nullptr_with_int_p() {
+ auto replace_nullptr_with_int_p = [](int** pp) {
+ assert(*pp == nullptr);
- replace_int_p(std::inout_ptr(cPtr));
- assert(cPtr == 84);
- }
- // ResettablePtr
+ *pp = new int{84};
+ };
+
+ // raw pointer
{
- ResettablePtr<int> rPtr(new int{90});
+ int* rPtr = nullptr;
- replace_int_p(std::inout_ptr(rPtr));
- assert(rPtr == 84);
+ replace_nullptr_with_int_p(std::inout_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
}
- // NonConstructiblePtr
+
+ // std::unique_ptr
{
- NonConstructiblePtr<int> nPtr;
- nPtr.reset(new int{90});
+ std::unique_ptr<int> uPtr;
- replace_int_p(std::inout_ptr(nPtr));
- assert(nPtr == 84);
+ replace_nullptr_with_int_p(std::inout_ptr(uPtr));
+ assert(*uPtr == 84);
}
}
int main(int, char**) {
- test_raw_ptr();
- test_unique_ptr();
- test_custom_ptr();
+ test_replace_int_p();
+ test_replace_int_p_with_nullptr();
+ test_replace_int_void_p();
+ test_replace_int_void_p_with_nullptr();
+ test_replace_nullptr_with_int_p();
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp
deleted file mode 100644
index a5189717fad62..0000000000000
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.cpp
+++ /dev/null
@@ -1,159 +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
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
-
-// <memory>
-
-// [out.ptr], function template out_ptr
-// template<class Pointer = void, class Smart, class... Args>
-// auto out_ptr(Smart& s, Args&&... args); // since c++23
-
-#include <cassert>
-#include <memory>
-
-#include "../types.h"
-
-// Test helpers.
-
-void get_int_p(int** pp) { *pp = new int{84}; }
-
-void get_int_p_nullptr(int** pp) { *pp = nullptr; }
-
-void get_int_void_p(void** pp) { *(reinterpret_cast<int**>(pp)) = new int{84}; }
-
-void get_int_void_p_nullptr(void** pp) { *pp = nullptr; }
-
-void get_SomeInt_p(SomeInt** pp) { *pp = new SomeInt{84}; }
-
-void get_SomeInt_void_p(void** pp) { *pp = reinterpret_cast<int*>(new int{84}); }
-
-// Test `std::out_ptr()` function.
-
-void test_raw_ptr() {
- {
- auto n{90};
- auto rPtr = &n;
-
- get_int_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
-
- get_int_p_nullptr(std::out_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
-
- get_int_void_p(std::inout_ptr<int*>(rPtr));
- assert(*rPtr == 84);
- delete rPtr;
-
- get_int_void_p_nullptr(std::out_ptr<int*>(rPtr));
- assert(rPtr == nullptr);
- }
- {
- SomeInt si{90};
- auto* rPtr = &si;
-
- get_SomeInt_p(std::out_ptr(rPtr));
- assert(rPtr->value == 84);
- delete rPtr;
- }
- {
- SomeInt si{90};
- auto* rPtr = &si;
-
- get_SomeInt_void_p(std::out_ptr<SomeInt*>(rPtr));
- assert(rPtr->value == 84);
- delete rPtr;
- }
-}
-
-void test_shared_ptr() {
- {
- auto sPtr = std::make_shared<int>(90);
-
- get_int_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
- assert(*sPtr == 84);
-
- sPtr.reset(new int(90));
-
- get_int_void_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
- assert(*sPtr == 84);
- }
- {
- auto sPtr = std::make_shared<SomeInt>(90);
-
- get_SomeInt_p(std::out_ptr(sPtr, [](auto* p) { delete p; }));
- assert(sPtr->value == 84);
- }
- {
- auto sPtr = std::make_shared<SomeInt>(90);
-
- get_SomeInt_void_p(std::out_ptr<SomeInt*>(sPtr, [](auto* p) { delete p; }));
- assert(sPtr->value == 84);
- }
-}
-
-void test_unique_ptr() {
- {
- auto uPtr = std::make_unique<int>(90);
-
- get_int_p(std::out_ptr(uPtr));
- assert(*uPtr == 84);
-
- uPtr.reset(new int{90});
-
- get_int_void_p(std::out_ptr(uPtr));
- assert(*uPtr == 84);
- }
- {
- auto uPtr = std::make_unique<SomeInt>(90);
-
- get_SomeInt_p(std::out_ptr(uPtr));
- assert(uPtr->value == 84);
- }
- {
- auto uPtr = std::make_unique<SomeInt>(90);
-
- get_SomeInt_void_p(std::out_ptr<SomeInt*>(uPtr));
- assert(uPtr->value == 84);
- }
-}
-
-void test_custom_ptr() {
- // ConstructiblePtr
- {
- ConstructiblePtr<int> cPtr(new int{90});
-
- get_int_p(std::out_ptr(cPtr));
- assert(cPtr == 84);
- }
- // ResettablePtr
- {
- ResettablePtr<int> rPtr(new int{90});
-
- get_int_p(std::out_ptr(rPtr));
- assert(rPtr == 84);
- }
- // NonConstructiblePtr
- {
- NonConstructiblePtr<int> nPtr;
- nPtr.reset(new int{90});
-
- get_int_p(std::out_ptr(nPtr));
- assert(nPtr == 84);
- }
-}
-
-int main(int, char**) {
- test_raw_ptr();
- test_shared_ptr();
- test_unique_ptr();
- test_custom_ptr();
-
- return 0;
-}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp
new file mode 100644
index 0000000000000..7fc1ed06a4d20
--- /dev/null
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp
@@ -0,0 +1,212 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
+
+// <memory>
+
+// [out.ptr], function template out_ptr
+// template<class Pointer = void, class Smart, class... Args>
+// auto out_ptr(Smart& s, Args&&... args); // since c++23
+
+#include <cassert>
+#include <memory>
+
+#include "../types.h"
+
+void test_get_int_p() {
+ auto get_int_p = [](int** pp) { *pp = new int{84}; };
+
+ // raw pointer
+ {
+ int* rPtr;
+
+ get_int_p(std::out_ptr<int*>(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
+ }
+
+ // std::unique_ptr
+ {
+ std::unique_ptr<int> uPtr;
+
+ get_int_p(std::out_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+
+ // std::shared_ptr
+ {
+ std::shared_ptr<int> sPtr;
+
+ get_int_p(std::out_ptr(sPtr, [](auto* p) {
+ assert(*p == 84);
+
+ delete p;
+ }));
+ assert(*sPtr == 84);
+ }
+
+ // pointer-like ConstructiblePtr
+ {
+ ConstructiblePtr<int> cPtr;
+
+ get_int_p(std::out_ptr(cPtr));
+ assert(cPtr == 84);
+ }
+
+ // pointer-like ResettablePtr
+ {
+ ResettablePtr<int> rPtr{nullptr};
+
+ get_int_p(std::out_ptr(rPtr));
+ assert(rPtr == 84);
+ }
+
+ // NonConstructiblePtr
+ {
+ NonConstructiblePtr<int> nPtr;
+
+ get_int_p(std::out_ptr(nPtr));
+ assert(nPtr == 84);
+ }
+}
+
+void test_get_int_p_nullptr() {
+ auto get_int_p_nullptr = [](int** pp) { *pp = nullptr; };
+ // raw pointer
+ {
+ int* rPtr;
+
+ get_int_p_nullptr(std::out_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+
+ delete rPtr;
+ }
+
+ // std::unique_ptr
+ {
+ std::unique_ptr<int> uPtr;
+
+ get_int_p_nullptr(std::out_ptr(uPtr));
+ assert(uPtr == nullptr);
+ }
+
+ // std::shared_ptr
+ {
+ std::shared_ptr<int> sPtr;
+
+ get_int_p_nullptr(std::out_ptr(sPtr, [](auto* p) {
+ assert(p == nullptr);
+
+ delete p;
+ }));
+ assert(sPtr == nullptr);
+ }
+}
+
+void test_get_int_void_p() {
+ auto get_int_void_p = [](void** pp) { *(reinterpret_cast<int**>(pp)) = new int{84}; };
+
+ // raw pointer
+ {
+ int* rPtr;
+
+ get_int_void_p(std::out_ptr(rPtr));
+ assert(*rPtr == 84);
+
+ delete rPtr;
+ }
+
+ // std::unique_ptr
+ {
+ std::unique_ptr<int> uPtr;
+
+ get_int_void_p(std::out_ptr(uPtr));
+ assert(*uPtr == 84);
+ }
+
+ // std::shared_ptr
+ {
+ std::shared_ptr<int> sPtr;
+
+ get_int_void_p(std::out_ptr(sPtr, [](auto* p) {
+ assert(*p == 84);
+
+ delete p;
+ }));
+ assert(*sPtr == 84);
+ }
+
+ // pointer-like ConstructiblePtr
+ {
+ ConstructiblePtr<int> cPtr;
+
+ get_int_void_p(std::out_ptr(cPtr));
+ assert(cPtr == 84);
+ }
+
+ // pointer-like ResettablePtr
+ {
+ ResettablePtr<int> rPtr{nullptr};
+
+ get_int_void_p(std::out_ptr(rPtr));
+ assert(rPtr == 84);
+ }
+
+ // NonConstructiblePtr
+ {
+ NonConstructiblePtr<int> nPtr;
+
+ get_int_void_p(std::out_ptr(nPtr));
+ assert(nPtr == 84);
+ }
+}
+
+void test_get_int_void_p_nullptr() {
+ auto get_int_void_p_nullptr = [](void** pp) { *pp = nullptr; };
+
+ // raw pointer
+ {
+ int* rPtr;
+
+ get_int_void_p_nullptr(std::out_ptr<int*>(rPtr));
+ assert(rPtr == nullptr);
+
+ delete rPtr;
+ }
+
+ // std::unique_ptr
+ {
+ std::unique_ptr<int> uPtr;
+
+ get_int_void_p_nullptr(std::out_ptr(uPtr));
+ assert(uPtr == nullptr);
+ }
+
+ // std::shared_ptr
+ {
+ std::shared_ptr<int> sPtr;
+
+ get_int_void_p_nullptr(std::out_ptr(sPtr, [](auto* p) {
+ assert(p == nullptr);
+
+ delete p;
+ }));
+ assert(sPtr == nullptr);
+ }
+}
+
+int main(int, char**) {
+ test_get_int_p();
+ test_get_int_p_nullptr();
+ test_get_int_void_p();
+ test_get_int_void_p_nullptr();
+
+ return 0;
+}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
index 3c51583421e76..2de75286307ad 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
@@ -16,6 +16,8 @@
#include <memory>
+#include "../types.h"
+
int main(int, char**) {
// `std::out_ptr<>` requires `std::shared_ptr<>` with a deleter.
{
@@ -27,5 +29,24 @@ int main(int, char**) {
auto outSPtr2 = std::out_ptr<int*>(sPtr);
}
+ // {
+ // DefaultDeleter<int> del;
+ // std::shared_ptr<int> sPtr;
+ // auto outSPtr1 = std::out_ptr(sPtr, del);
+ // auto outSPtr2 = std::out_ptr<int*>(sPtr, del);
+ // }
+
+ // {
+ // std::shared_ptr<int> sPtr;
+ // auto outSPtr1 = std::out_ptr(sPtr, CopyableMovableDeleter<int>{});
+ // auto outSPtr2 = std::out_ptr<int*>(sPtr, CopyableMovableDeleter<int>{});
+ // }
+
+ // {
+ // std::shared_ptr<int> sPtr;
+ // auto outSPtr1 = std::out_ptr(sPtr, NotCopyAbleNotMovableDeleter<int>{});
+ // auto outSPtr2 = std::out_ptr<int*>(sPtr, NotCopyAbleNotMovableDeleter<int>{});
+ // }
+
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 0e2dad400308d..46d4ba379b0f1 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -12,6 +12,29 @@
#include <type_traits>
#include <memory>
+template <typename T>
+class DefaultDeleter {
+ void operator()(T* p) const { delete p; }
+};
+
+template <typename T>
+struct CopyableMovableDeleter {
+ CopyableMovableDeleter() = default;
+ CopyableMovableDeleter(CopyableMovableDeleter const&) = default;
+ CopyableMovableDeleter(CopyableMovableDeleter&&) = default;
+
+ void operator()(T* p) const { delete p; }
+};
+
+template <typename T>
+struct NotCopyAbleNotMovableDeleter {
+ NotCopyAbleNotMovableDeleter() = default;
+ NotCopyAbleNotMovableDeleter(NotCopyAbleNotMovableDeleter const&) = delete; // not copyable
+ NotCopyAbleNotMovableDeleter(NotCopyAbleNotMovableDeleter&&) = delete; // not movable either!
+
+ void operator()(T* p) const { delete p; }
+};
+
struct ResetArg {};
// Custom pointer types.
>From af88c857d8f754c3712e4d32092241755dc5b8d4 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <zingam at outlook.com>
Date: Fri, 15 Dec 2023 18:55:16 +0200
Subject: [PATCH 08/35] Renamed directories
---
.../adapt/{inout.ptr => inout_ptr}/inout_ptr.general.pass.cpp | 0
.../smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr.verify.cpp | 0
.../adapt/{inout.ptr => inout_ptr}/inout_ptr_t.convert.pass.cpp | 0
.../adapt/{inout.ptr => inout_ptr}/inout_ptr_t.ctor.pass.cpp | 0
.../adapt/{inout.ptr => inout_ptr}/inout_ptr_t.verify.cpp | 0
.../smartptr/adapt/{out.ptr => out_ptr}/out_ptr.general.pass.cpp | 0
.../smartptr/adapt/{out.ptr => out_ptr}/out_ptr.verify.cpp | 0
.../adapt/{out.ptr => out_ptr}/out_ptr_t.convert.pass.cpp | 0
.../smartptr/adapt/{out.ptr => out_ptr}/out_ptr_t.ctor.pass.cpp | 0
.../smartptr/adapt/{out.ptr => out_ptr}/out_ptr_t.verify.cpp | 0
10 files changed, 0 insertions(+), 0 deletions(-)
rename libcxx/test/std/utilities/smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr.general.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr.verify.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr_t.convert.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr_t.ctor.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{inout.ptr => inout_ptr}/inout_ptr_t.verify.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr => out_ptr}/out_ptr.general.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr => out_ptr}/out_ptr.verify.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr => out_ptr}/out_ptr_t.convert.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr => out_ptr}/out_ptr_t.ctor.pass.cpp (100%)
rename libcxx/test/std/utilities/smartptr/adapt/{out.ptr => out_ptr}/out_ptr_t.verify.cpp (100%)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.general.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.convert.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.ctor.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/inout.ptr/inout_ptr_t.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.general.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.convert.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.ctor.pass.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
similarity index 100%
rename from libcxx/test/std/utilities/smartptr/adapt/out.ptr/out_ptr_t.verify.cpp
rename to libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
>From d7c04396da8d0c6b2270643a3a079e5cd95e887a Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sat, 16 Dec 2023 21:02:26 +0200
Subject: [PATCH 09/35] Addressed comments: Added `MoveOnlyDeleter` test
---
libcxx/include/__memory/out_ptr.h | 3 --
.../inout_ptr/inout_ptr.general.pass.cpp | 9 +++++
.../adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp | 8 +++++
.../adapt/out_ptr/out_ptr.general.pass.cpp | 9 +++++
.../adapt/out_ptr/out_ptr_t.convert.pass.cpp | 1 -
.../adapt/out_ptr/out_ptr_t.ctor.pass.cpp | 8 +++++
.../test/std/utilities/smartptr/adapt/types.h | 35 +++++++++++--------
7 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 618fc372bd965..1938bef8f1c27 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -27,9 +27,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 23
-template <class _Tp>
-concept __resettable_adapted_ptr = requires(_Tp __ptr) { __ptr().reset(); };
-
template <class _Smart, class _Pointer, class... _Args>
class _LIBCPP_TEMPLATE_VIS out_ptr_t {
static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0,
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
index 4114ab6ee7549..93ee6cf14eea2 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
@@ -45,6 +45,15 @@ void test_replace_int_p() {
assert(*uPtr == 84);
}
+ {
+ MoveOnlyDeleter<int> del;
+ std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr{new int{90}};
+
+ replace_int_p(std::inout_ptr(uPtr, std::move(del)));
+ assert(*uPtr == 84);
+ assert(uPtr.get_deleter().wasMoveInitilized == true);
+ }
+
// pointer-like ConstructiblePtr
{
ConstructiblePtr<int> cPtr(new int{90});
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
index 0a21a41539e43..1def6931441d3 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
@@ -19,6 +19,7 @@
#include <memory>
#include "test_convertible.h"
+#include "../types.h"
int main(int, char**) {
{
@@ -29,6 +30,7 @@ int main(int, char**) {
static_assert(
!test_convertible<std::inout_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
}
+
{
auto deleter = [](auto* p) { delete p; };
std::unique_ptr<int, decltype(deleter)> uPtr;
@@ -39,5 +41,11 @@ int main(int, char**) {
"This constructor must be explicit");
}
+ {
+ std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr;
+
+ std::inout_ptr_t<decltype(uPtr), int*, MoveOnlyDeleter<int>>{uPtr, MoveOnlyDeleter<int>{}};
+ }
+
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
index 7fc1ed06a4d20..1f06a2206698f 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
@@ -40,6 +40,15 @@ void test_get_int_p() {
assert(*uPtr == 84);
}
+ {
+ MoveOnlyDeleter<int> del;
+ std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr;
+
+ get_int_p(std::out_ptr(uPtr, std::move(del)));
+ assert(*uPtr == 84);
+ assert(uPtr.get_deleter().wasMoveInitilized == true);
+ }
+
// std::shared_ptr
{
std::shared_ptr<int> sPtr;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
index 1e19d1ee5b4ec..168d0b99875a4 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
@@ -20,7 +20,6 @@
#include <cassert>
#include <concepts>
#include <memory>
-#include <iostream>
int main(int, char**) {
{
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
index 39604247216e8..0ec834cc2f354 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
@@ -19,6 +19,7 @@
#include <memory>
#include "test_convertible.h"
+#include "../types.h"
int main(int, char**) {
{
@@ -28,6 +29,7 @@ int main(int, char**) {
static_assert(!test_convertible<std::out_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
}
+
{
std::unique_ptr<int, std::default_delete<int>> uPtr;
@@ -37,5 +39,11 @@ int main(int, char**) {
"This constructor must be explicit");
}
+ {
+ std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr;
+
+ std::out_ptr_t<decltype(uPtr), int*, MoveOnlyDeleter<int>>{uPtr, MoveOnlyDeleter<int>{}};
+ }
+
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 46d4ba379b0f1..330848803c478 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -12,10 +12,7 @@
#include <type_traits>
#include <memory>
-template <typename T>
-class DefaultDeleter {
- void operator()(T* p) const { delete p; }
-};
+// Custom deleters.
template <typename T>
struct CopyableMovableDeleter {
@@ -26,6 +23,24 @@ struct CopyableMovableDeleter {
void operator()(T* p) const { delete p; }
};
+template <typename T>
+struct DefaultDeleter {
+ void operator()(T* p) const { delete p; }
+};
+
+template <typename T>
+struct MoveOnlyDeleter {
+ MoveOnlyDeleter() = default;
+ MoveOnlyDeleter(const MoveOnlyDeleter&) = delete;
+ MoveOnlyDeleter& operator=(const MoveOnlyDeleter&) = delete;
+ MoveOnlyDeleter(MoveOnlyDeleter&&) : wasMoveInitilized{true} {}
+ MoveOnlyDeleter& operator=(MoveOnlyDeleter&&) = default;
+
+ void operator()(T* p) const { delete p; }
+
+ bool wasMoveInitilized = false;
+};
+
template <typename T>
struct NotCopyAbleNotMovableDeleter {
NotCopyAbleNotMovableDeleter() = default;
@@ -35,8 +50,6 @@ struct NotCopyAbleNotMovableDeleter {
void operator()(T* p) const { delete p; }
};
-struct ResetArg {};
-
// Custom pointer types.
template <typename _Tp>
@@ -57,6 +70,8 @@ struct ConstructiblePtr {
static_assert(std::is_same_v<std::__pointer_of_t< ConstructiblePtr<int>>, int* >);
static_assert(std::is_constructible_v< ConstructiblePtr<int>, int* >);
+struct ResetArg {};
+
template <typename _Tp>
struct ResettablePtr {
using element_type = _Tp;
@@ -89,12 +104,4 @@ struct NonConstructiblePtr : public ResettablePtr<_Tp> {
static_assert(std::is_same_v<std::__pointer_of_t< NonConstructiblePtr<int>>, int* >);
static_assert(!std::is_constructible_v< NonConstructiblePtr<int>, int* >);
-// Custom types.
-
-struct SomeInt {
- int value;
-
- constexpr explicit SomeInt(int val = 0) : value{val} {}
-};
-
#endif // TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
>From 54c2a41eabdbc14462da5025962f5de973375aa8 Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sat, 16 Dec 2023 23:38:47 +0200
Subject: [PATCH 10/35] Tweaked convert.pass tests
---
.../adapt/inout_ptr/inout_ptr_t.convert.pass.cpp | 14 ++++++++++++++
.../adapt/out_ptr/out_ptr_t.convert.pass.cpp | 4 ++++
2 files changed, 18 insertions(+)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp
index cee19c11c78c3..230402af07cfe 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.convert.pass.cpp
@@ -22,6 +22,7 @@
#include <memory>
int main(int, char**) {
+ // operator Pointer*()
{
std::unique_ptr<int> uPtr = std::make_unique<int>(84);
@@ -32,6 +33,19 @@ int main(int, char**) {
assert(**pPtr == 84);
}
+
+ {
+ std::unique_ptr<int, std::default_delete<int>> uPtr = std::make_unique<int>(84);
+
+ const std::inout_ptr_t<decltype(uPtr), int*, std::default_delete<int>> ioPtr{uPtr, std::default_delete<int>{}};
+
+ static_assert(noexcept(ioPtr.operator int**()));
+ std::same_as<int**> decltype(auto) pPtr = ioPtr.operator int**();
+
+ assert(**pPtr == 84);
+ }
+
+ // operator void**()
{
std::unique_ptr<int> uPtr = std::make_unique<int>(84);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
index 168d0b99875a4..dff9ed93c3011 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
@@ -22,6 +22,7 @@
#include <memory>
int main(int, char**) {
+ // operator Pointer*()
{
std::unique_ptr<int> uPtr;
@@ -32,6 +33,7 @@ int main(int, char**) {
assert(*pPtr == nullptr);
}
+
{
std::unique_ptr<int, std::default_delete<int>> uPtr;
@@ -42,6 +44,8 @@ int main(int, char**) {
assert(*pPtr == nullptr);
}
+
+ // operator void**()
{
std::unique_ptr<int> uPtr;
>From 1a4e2e86bd63f17038d4aa690850fc85fab631aa Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 00:08:41 +0200
Subject: [PATCH 11/35] Try to fix CI
---
.../utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp | 2 +-
.../utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
index dff9ed93c3011..828a5d0ba31ea 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.convert.pass.cpp
@@ -22,7 +22,7 @@
#include <memory>
int main(int, char**) {
- // operator Pointer*()
+ // operator Pointer*()
{
std::unique_ptr<int> uPtr;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
index 0ec834cc2f354..474ab3c162e90 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
@@ -29,7 +29,7 @@ int main(int, char**) {
static_assert(!test_convertible<std::out_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
}
-
+
{
std::unique_ptr<int, std::default_delete<int>> uPtr;
>From 378b37430d414db2506f8abad204187db4a33dde Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 01:05:40 +0200
Subject: [PATCH 12/35] Try to fix CI
---
.../smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp | 1 +
.../utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp | 1 +
2 files changed, 2 insertions(+)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
index 93ee6cf14eea2..3a3163d0ee40c 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <memory>
+#include <utility>
#include "../types.h"
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
index 1f06a2206698f..6d2065dcc2b36 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
@@ -16,6 +16,7 @@
#include <cassert>
#include <memory>
+#include <utility>
#include "../types.h"
>From 1515a3dabdc05cd0574e16d732a406f9a53775d1 Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 15:42:36 +0200
Subject: [PATCH 13/35] Refactored if constexpr else case
---
libcxx/include/__memory/inout_ptr.h | 7 +++----
libcxx/include/__memory/out_ptr.h | 8 ++------
.../smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp | 1 +
3 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index 18157b271cd75..4106da7508101 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -51,6 +51,7 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
_LIBCPP_HIDE_FROM_ABI inout_ptr_t(const inout_ptr_t&) = delete;
_LIBCPP_HIDE_FROM_ABI ~inout_ptr_t() {
+ // LWG-3897 inout_ptr will not update raw pointer to null
if constexpr (!is_pointer_v<_Smart>) {
if (!__p_) {
return;
@@ -64,12 +65,10 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
} else if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
- } else if constexpr (is_constructible_v<_Smart, _SP, _Args...>) {
+ } else {
+ static_assert(is_constructible_v<_Smart, _SP, _Args...>);
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
- } else {
- static_assert(is_pointer_v<_Smart> || __resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
- is_constructible_v<_Smart, _SP, _Args...>);
}
}
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 1938bef8f1c27..9abbd81b01a92 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -56,14 +56,10 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
if constexpr (__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>) {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
- } else if constexpr (is_constructible_v<_Smart, _SP, _Args...>) {
+ } else {
+ static_assert(is_constructible_v<_Smart, _SP, _Args...>);
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
- } else {
- // static_assert(__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...>);
- // static_assert(is_constructible_v<_Smart, _SP, _Args...>);
- static_assert(__resettable_smart_pointer_with_args<_Smart, _Pointer, _Args...> ||
- is_constructible_v<_Smart, _SP, _Args...>);
}
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
index 3a3163d0ee40c..312df25c40c0f 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
@@ -91,6 +91,7 @@ void test_replace_int_p_with_nullptr() {
// raw pointer
{
+ // LWG-3897 inout_ptr will not update raw pointer to null
auto rPtr = new int{90};
replace_int_p_with_nullptr(std::inout_ptr<int*>(rPtr));
>From da7d5e53aead3e82e80db2c015779f329173443e Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 16:22:13 +0200
Subject: [PATCH 14/35] Refactored verify.cpp
---
.../adapt/inout_ptr/inout_ptr.verify.cpp | 31 +++++++++--
.../smartptr/adapt/out_ptr/out_ptr.verify.cpp | 53 +++++++++++--------
2 files changed, 60 insertions(+), 24 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
index eb296767085b7..8f25f4acf7d87 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
@@ -15,17 +15,42 @@
// auto inout_ptr(Smart& s, Args&&... args); // since c++23
#include <memory>
+#include <tuple>
+
+#include "../types.h"
int main(int, char**) {
// `std::inout_ptr<>` does not support `std::shared_ptr<>`.
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
- auto inoutUPtr1 = std::inout_ptr(sPtr);
+ // expected-error-re@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
+ std::ignore = std::inout_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::inout_ptr_t<shared_ptr<int>, _Ptr>' (aka 'inout_ptr_t<std::shared_ptr<int>, int *>'}}
- auto inoutUPtr2 = std::inout_ptr<int*>(sPtr);
+ std::ignore = std::inout_ptr<int*>(sPtr);
+ }
+
+#if 0
+
+ {
+ // CopyableMovableDeleter<int> del;
+ // std::unique_ptr<int> uPtr;
+
+ // -expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
+ // -expected-error@*:* {{no matching constructor for initialization of 'std::unique_ptr<int>'}}
+ // std::ignore = std::inout_ptr(uPtr, del);
+ // std::ignore = std::inout_ptr<int*>(uPtr, del);
+ }
+
+ {
+ NotCopyAbleNotMovableDeleter<int> del;
+ std::unique_ptr<int> uPtr;
+
+ // e-xpected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
+ std::ignore = std::inout_ptr(uPtr, del);
+ std::ignore = std::inout_ptr<int*>(uPtr, del);
}
+#endif
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index 2de75286307ad..cf96a5c4aac44 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -15,6 +15,7 @@
// auto out_ptr(Smart& s, Args&&... args); // since c++23
#include <memory>
+#include <tuple>
#include "../types.h"
@@ -23,30 +24,40 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
- auto outSPtr1 = std::out_ptr(sPtr);
+ // expected-error-re@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ std::ignore = std::out_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<shared_ptr<int>, _Ptr>' (aka 'out_ptr_t<std::shared_ptr<int>, int *>')}}
- auto outSPtr2 = std::out_ptr<int*>(sPtr);
+ std::ignore = std::out_ptr<int*>(sPtr);
}
- // {
- // DefaultDeleter<int> del;
- // std::shared_ptr<int> sPtr;
- // auto outSPtr1 = std::out_ptr(sPtr, del);
- // auto outSPtr2 = std::out_ptr<int*>(sPtr, del);
- // }
-
- // {
- // std::shared_ptr<int> sPtr;
- // auto outSPtr1 = std::out_ptr(sPtr, CopyableMovableDeleter<int>{});
- // auto outSPtr2 = std::out_ptr<int*>(sPtr, CopyableMovableDeleter<int>{});
- // }
-
- // {
- // std::shared_ptr<int> sPtr;
- // auto outSPtr1 = std::out_ptr(sPtr, NotCopyAbleNotMovableDeleter<int>{});
- // auto outSPtr2 = std::out_ptr<int*>(sPtr, NotCopyAbleNotMovableDeleter<int>{});
- // }
+#if 0
+
+ {
+ DefaultDeleter<int> del;
+ std::unique_ptr<int> uPtr;
+
+ std::ignore = std::out_ptr(uPtr, del);
+ std::ignore = std::out_ptr<int*>(uPtr, del);
+ }
+
+ {
+ CopyableMovableDeleter<int> del;
+ std::shared_ptr<int> uPtr;
+
+ // expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
+ std::ignore = std::out_ptr(uPtr, del);
+ // expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
+ std::ignore = std::out_ptr<int*>(uPtr, del);
+ }
+
+ {
+ NotCopyAbleNotMovableDeleter<int> del;
+ std::shared_ptr<int> uPtr;
+
+ std::ignore = std::out_ptr(uPtr, del);
+ std::ignore = std::out_ptr<int*>(uPtr, del);
+ }
+#endif
return 0;
}
>From df87f89e3ec061f01681e640ed4373a67008ab2a Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 18:19:13 +0200
Subject: [PATCH 15/35] WIP
---
.../adapt/inout_ptr/inout_ptr.verify.cpp | 22 +++++++++----------
.../smartptr/adapt/out_ptr/out_ptr.verify.cpp | 9 ++++----
.../test/std/utilities/smartptr/adapt/types.h | 8 ++++---
3 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
index 8f25f4acf7d87..a2d1e363b16f5 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
@@ -30,26 +30,24 @@ int main(int, char**) {
std::ignore = std::inout_ptr<int*>(sPtr);
}
-#if 0
-
{
- // CopyableMovableDeleter<int> del;
- // std::unique_ptr<int> uPtr;
+ CopyableMovableDeleter<int> del;
+ std::unique_ptr<int, CopyableMovableDeleter<int>> uPtr;
- // -expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
- // -expected-error@*:* {{no matching constructor for initialization of 'std::unique_ptr<int>'}}
- // std::ignore = std::inout_ptr(uPtr, del);
- // std::ignore = std::inout_ptr<int*>(uPtr, del);
+ std::ignore = std::inout_ptr(uPtr, del);
+ std::ignore = std::inout_ptr<int*>(uPtr, del);
}
{
NotCopyAbleNotMovableDeleter<int> del;
- std::unique_ptr<int> uPtr;
+ std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>> uPtr;
- // e-xpected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
- std::ignore = std::inout_ptr(uPtr, del);
- std::ignore = std::inout_ptr<int*>(uPtr, del);
+ // -expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>>, int *, NotCopyAbleNotMovableDeleter<int> &>'}}
+ // -expected-error@*:* {{object of type 'NotCopyAbleNotMovableDeleter<int>' cannot be assigned because its copy assignment operator is implicitly deleted}}
+ std::ignore = std::inout_ptr(uPtr, std::move(del));
+ // std::ignore = std::inout_ptr<int*>(uPtr, del);
}
+#if 0
#endif
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index cf96a5c4aac44..345b09bc6a9bf 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -30,11 +30,9 @@ int main(int, char**) {
std::ignore = std::out_ptr<int*>(sPtr);
}
-#if 0
-
{
DefaultDeleter<int> del;
- std::unique_ptr<int> uPtr;
+ std::unique_ptr<int, DefaultDeleter<int>> uPtr;
std::ignore = std::out_ptr(uPtr, del);
std::ignore = std::out_ptr<int*>(uPtr, del);
@@ -42,7 +40,7 @@ int main(int, char**) {
{
CopyableMovableDeleter<int> del;
- std::shared_ptr<int> uPtr;
+ std::unique_ptr<int, CopyableMovableDeleter<int>> uPtr;
// expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
std::ignore = std::out_ptr(uPtr, del);
@@ -50,9 +48,10 @@ int main(int, char**) {
std::ignore = std::out_ptr<int*>(uPtr, del);
}
+#if 0
{
NotCopyAbleNotMovableDeleter<int> del;
- std::shared_ptr<int> uPtr;
+ std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>> uPtr;
std::ignore = std::out_ptr(uPtr, del);
std::ignore = std::out_ptr<int*>(uPtr, del);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 330848803c478..425113a2a44cb 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -16,9 +16,11 @@
template <typename T>
struct CopyableMovableDeleter {
- CopyableMovableDeleter() = default;
- CopyableMovableDeleter(CopyableMovableDeleter const&) = default;
- CopyableMovableDeleter(CopyableMovableDeleter&&) = default;
+ CopyableMovableDeleter() = default;
+ CopyableMovableDeleter(CopyableMovableDeleter const&) = default;
+ CopyableMovableDeleter& operator=(CopyableMovableDeleter const&) = default;
+ CopyableMovableDeleter(CopyableMovableDeleter&&) = default;
+ CopyableMovableDeleter& operator=(CopyableMovableDeleter&&) = default;
void operator()(T* p) const { delete p; }
};
>From 49fa86fa78d77eb74d4fe12b7ec53620b2bba37e Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Sun, 17 Dec 2023 20:35:38 +0200
Subject: [PATCH 16/35] Cleanup
---
.../adapt/inout_ptr/inout_ptr.verify.cpp | 20 ---------------
.../smartptr/adapt/out_ptr/out_ptr.verify.cpp | 20 ---------------
.../test/std/utilities/smartptr/adapt/types.h | 25 -------------------
3 files changed, 65 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
index a2d1e363b16f5..a5dabb92ab683 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
@@ -30,25 +30,5 @@ int main(int, char**) {
std::ignore = std::inout_ptr<int*>(sPtr);
}
- {
- CopyableMovableDeleter<int> del;
- std::unique_ptr<int, CopyableMovableDeleter<int>> uPtr;
-
- std::ignore = std::inout_ptr(uPtr, del);
- std::ignore = std::inout_ptr<int*>(uPtr, del);
- }
-
- {
- NotCopyAbleNotMovableDeleter<int> del;
- std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>> uPtr;
-
- // -expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>>, int *, NotCopyAbleNotMovableDeleter<int> &>'}}
- // -expected-error@*:* {{object of type 'NotCopyAbleNotMovableDeleter<int>' cannot be assigned because its copy assignment operator is implicitly deleted}}
- std::ignore = std::inout_ptr(uPtr, std::move(del));
- // std::ignore = std::inout_ptr<int*>(uPtr, del);
- }
-#if 0
-#endif
-
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index 345b09bc6a9bf..5c48197ff1630 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -38,25 +38,5 @@ int main(int, char**) {
std::ignore = std::out_ptr<int*>(uPtr, del);
}
- {
- CopyableMovableDeleter<int> del;
- std::unique_ptr<int, CopyableMovableDeleter<int>> uPtr;
-
- // expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
- std::ignore = std::out_ptr(uPtr, del);
- // expected-error@*:* {{static assertion failed due to requirement 'is_constructible_v<std::unique_ptr<int, std::default_delete<int>>, int *, CopyableMovableDeleter<int> &>'}}
- std::ignore = std::out_ptr<int*>(uPtr, del);
- }
-
-#if 0
- {
- NotCopyAbleNotMovableDeleter<int> del;
- std::unique_ptr<int, NotCopyAbleNotMovableDeleter<int>> uPtr;
-
- std::ignore = std::out_ptr(uPtr, del);
- std::ignore = std::out_ptr<int*>(uPtr, del);
- }
-#endif
-
return 0;
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 425113a2a44cb..3d8513084bd90 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -14,22 +14,6 @@
// Custom deleters.
-template <typename T>
-struct CopyableMovableDeleter {
- CopyableMovableDeleter() = default;
- CopyableMovableDeleter(CopyableMovableDeleter const&) = default;
- CopyableMovableDeleter& operator=(CopyableMovableDeleter const&) = default;
- CopyableMovableDeleter(CopyableMovableDeleter&&) = default;
- CopyableMovableDeleter& operator=(CopyableMovableDeleter&&) = default;
-
- void operator()(T* p) const { delete p; }
-};
-
-template <typename T>
-struct DefaultDeleter {
- void operator()(T* p) const { delete p; }
-};
-
template <typename T>
struct MoveOnlyDeleter {
MoveOnlyDeleter() = default;
@@ -43,15 +27,6 @@ struct MoveOnlyDeleter {
bool wasMoveInitilized = false;
};
-template <typename T>
-struct NotCopyAbleNotMovableDeleter {
- NotCopyAbleNotMovableDeleter() = default;
- NotCopyAbleNotMovableDeleter(NotCopyAbleNotMovableDeleter const&) = delete; // not copyable
- NotCopyAbleNotMovableDeleter(NotCopyAbleNotMovableDeleter&&) = delete; // not movable either!
-
- void operator()(T* p) const { delete p; }
-};
-
// Custom pointer types.
template <typename _Tp>
>From 73c36a15b97f77a552874f2096fa98eb35d534a1 Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Wed, 20 Dec 2023 08:33:36 +0200
Subject: [PATCH 17/35] Fixed test
---
.../utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp | 8 --------
1 file changed, 8 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index 5c48197ff1630..5796a55561ef7 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -30,13 +30,5 @@ int main(int, char**) {
std::ignore = std::out_ptr<int*>(sPtr);
}
- {
- DefaultDeleter<int> del;
- std::unique_ptr<int, DefaultDeleter<int>> uPtr;
-
- std::ignore = std::out_ptr(uPtr, del);
- std::ignore = std::out_ptr<int*>(uPtr, del);
- }
-
return 0;
}
>From ae04dfbdb5f2bd31753885ada74306ddcfb22361 Mon Sep 17 00:00:00 2001
From: Zingam <zingam at outlook.com>
Date: Mon, 22 Jan 2024 13:04:21 +0200
Subject: [PATCH 18/35] Run generator script
---
libcxx/include/libcxx.imp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
index 8616f9639f4d9..d1f0e7b712c8d 100644
--- a/libcxx/include/libcxx.imp
+++ b/libcxx/include/libcxx.imp
@@ -523,6 +523,8 @@
{ include: [ "<__memory/concepts.h>", "private", "<memory>", "public" ] },
{ include: [ "<__memory/construct_at.h>", "private", "<memory>", "public" ] },
{ include: [ "<__memory/destruct_n.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/inout_ptr.h>", "private", "<memory>", "public" ] },
+ { include: [ "<__memory/out_ptr.h>", "private", "<memory>", "public" ] },
{ include: [ "<__memory/pointer_traits.h>", "private", "<memory>", "public" ] },
{ include: [ "<__memory/ranges_construct_at.h>", "private", "<memory>", "public" ] },
{ include: [ "<__memory/ranges_uninitialized_algorithms.h>", "private", "<memory>", "public" ] },
>From c0541c6e63f2688b3276ddea9689d84ffb1c7da4 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Mon, 29 Jan 2024 23:47:31 +0200
Subject: [PATCH 19/35] Updated release notes
---
libcxx/docs/ReleaseNotes/19.rst | 1 +
libcxx/docs/Status/Cxx23Issues.csv | 2 +-
libcxx/docs/Status/Cxx23Papers.csv | 2 +-
libcxx/docs/Status/Cxx2cIssues.csv | 2 +-
4 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index 17a0415a8ad43..84a4e3911fb49 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -38,6 +38,7 @@ What's New in Libc++ 19.0.0?
Implemented Papers
------------------
- P2637R3 - Member ``visit``
+- P1132R8 - ``out_ptr`` - a scalable output pointer abstraction
Improvements and New Features
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index 2a18106b7832e..511c36c7a360f 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -192,7 +192,7 @@
"`3515 <https://wg21.link/LWG3515>`__","§[stacktrace.basic.nonmem]: ``operator<<`` should be less templatized", "November 2022","","",""
"`3545 <https://wg21.link/LWG3545>`__","``std::pointer_traits`` should be SFINAE-friendly", "November 2022","|Complete|","18.0",""
"`3569 <https://wg21.link/LWG3569>`__","``join_view`` fails to support ranges of ranges with non-default_initializable iterators", "November 2022","","","|ranges|"
-"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","|Complete|","18.0",""
+"`3594 <https://wg21.link/LWG3594>`__","``inout_ptr`` — inconsistent ``release()`` in destructor", "November 2022","|Complete|","19.0",""
"`3597 <https://wg21.link/LWG3597>`__","Unsigned integer types don't model advanceable", "November 2022","","","|ranges|"
"`3600 <https://wg21.link/LWG3600>`__","Making ``istream_iterator`` copy constructor trivial is an ABI break", "November 2022","","",""
"`3629 <https://wg21.link/LWG3629>`__","``make_error_code`` and ``make_error_condition`` are customization points","November 2022","|Complete|","16.0",""
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index f0fba1c3f8c96..9d83d7e089a68 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -13,7 +13,7 @@
"","","","","","",""
"`P0401R6 <https://wg21.link/P0401R6>`__","LWG","Providing size feedback in the Allocator interface","June 2021","|Complete|","15.0"
"`P0448R4 <https://wg21.link/P0448R4>`__","LWG","A strstream replacement using span<charT> as buffer","June 2021","",""
-"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","|Complete|","18.0"
+"`P1132R8 <https://wg21.link/P1132R8>`__","LWG","out_ptr - a scalable output pointer abstraction","June 2021","|Complete|","19.0"
"`P1328R1 <https://wg21.link/P1328R1>`__","LWG","Making std::type_info::operator== constexpr","June 2021","|Complete|","17.0"
"`P1425R4 <https://wg21.link/P1425R4>`__","LWG","Iterators pair constructors for stack and queue","June 2021","|Complete|","14.0","|ranges|"
"`P1518R2 <https://wg21.link/P1518R2>`__","LWG","Stop overconstraining allocators in container deduction guides","June 2021","|Complete|","13.0"
diff --git a/libcxx/docs/Status/Cxx2cIssues.csv b/libcxx/docs/Status/Cxx2cIssues.csv
index 326ff29920d53..36a19e18d711a 100644
--- a/libcxx/docs/Status/Cxx2cIssues.csv
+++ b/libcxx/docs/Status/Cxx2cIssues.csv
@@ -24,7 +24,7 @@
"`3749 <https://wg21.link/LWG3749>`__","``common_iterator`` should handle integer-class difference types","Kona November 2023","","",""
"`3809 <https://wg21.link/LWG3809>`__","Is ``std::subtract_with_carry_engine<uint16_t>`` supposed to work","Kona November 2023","","",""
"`3892 <https://wg21.link/LWG3892>`__","Incorrect formatting of nested ranges and tuples","Kona November 2023","|Complete|","17.0","|format|"
-"`3897 <https://wg21.link/LWG3897>`__","``inout_ptr`` will not update raw pointer to 0","Kona November 2023","|Complete|","18.0",""
+"`3897 <https://wg21.link/LWG3897>`__","``inout_ptr`` will not update raw pointer to 0","Kona November 2023","|Complete|","19.0",""
"`3946 <https://wg21.link/LWG3946>`__","The definition of ``const_iterator_t`` should be reworked","Kona November 2023","","",""
"`3947 <https://wg21.link/LWG3947>`__","Unexpected constraints on ``adjacent_transform_view::base()``","Kona November 2023","","","|ranges|"
"`3948 <https://wg21.link/LWG3948>`__","``possibly-const-range and as-const-pointer`` should be ``noexcept``","Kona November 2023","","","|ranges|"
>From 2902fe50c00f38a73e64b0381c01702bb012dadd Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 30 Jan 2024 00:13:03 +0200
Subject: [PATCH 20/35] Try to fix CI: added `#include <__utility/move.h>`
---
libcxx/include/__memory/inout_ptr.h | 1 +
libcxx/include/__memory/out_ptr.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index 4106da7508101..ddaa2e506fc7f 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -18,6 +18,7 @@
#include <__type_traits/is_same.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_void.h>
+#include <__utility/move.h>
#include <tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 9abbd81b01a92..7ad7ac6d0876b 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -17,6 +17,7 @@
#include <__memory/unique_ptr.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_void.h>
+#include <__utility/move.h>
#include <tuple>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
>From 398914a59a352360b582e1dd1dc13e2098bbb888 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 30 Jan 2024 00:14:58 +0200
Subject: [PATCH 21/35] Try to fix CI: added `#include <__utility/forward.h>`
---
libcxx/include/__memory/inout_ptr.h | 1 +
libcxx/include/__memory/out_ptr.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index ddaa2e506fc7f..620685ca0428e 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -18,6 +18,7 @@
#include <__type_traits/is_same.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_void.h>
+#include <__utility/forward.h>
#include <__utility/move.h>
#include <tuple>
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 7ad7ac6d0876b..256e6334d51f3 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -17,6 +17,7 @@
#include <__memory/unique_ptr.h>
#include <__type_traits/is_specialization.h>
#include <__type_traits/is_void.h>
+#include <__utility/forward.h>
#include <__utility/move.h>
#include <tuple>
>From fbc5a8186835e976c3daf1927310e0b1437db01e Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 30 Jan 2024 07:01:12 +0200
Subject: [PATCH 22/35] Added `__LIBCPP_PUSH_MACROS` and `__LIBCPP_POP_MACROS`
---
libcxx/include/__memory/inout_ptr.h | 5 +++++
libcxx/include/__memory/out_ptr.h | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index 620685ca0428e..b49940ca8bc25 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -26,6 +26,9 @@
# pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 23
@@ -100,4 +103,6 @@ _LIBCPP_HIDE_FROM_ABI auto inout_ptr(_Smart& __s, _Args&&... __args) {
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___INOUT_PTR_H
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 256e6334d51f3..95a8b8a6fe83e 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -25,6 +25,9 @@
# pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER >= 23
@@ -91,4 +94,6 @@ _LIBCPP_HIDE_FROM_ABI auto out_ptr(_Smart& __s, _Args&&... __args) {
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___OUT_PTR_H
>From cfd8356d12f8b6f7fe838cb137e6f28b4f6c3642 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Tue, 30 Jan 2024 07:04:04 +0200
Subject: [PATCH 23/35] Added `__LIBCPP_PUSH_MACROS` and `__LIBCPP_POP_MACROS`
---
libcxx/include/__memory/pointer_traits.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libcxx/include/__memory/pointer_traits.h b/libcxx/include/__memory/pointer_traits.h
index 0168856851d2f..73d930b372267 100644
--- a/libcxx/include/__memory/pointer_traits.h
+++ b/libcxx/include/__memory/pointer_traits.h
@@ -27,6 +27,9 @@
# pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
// clang-format off
@@ -299,4 +302,6 @@ concept __resettable_smart_pointer_with_args = requires(_Smart __s, _Pointer __p
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___MEMORY_POINTER_TRAITS_H
>From 7d59cf6e47aab1a38775061949cad0c2918649de Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 10 Jul 2024 22:42:35 +0300
Subject: [PATCH 24/35] Update: run generator scripts
---
libcxx/docs/FeatureTestMacroTable.rst | 4 +--
libcxx/include/version | 2 +-
.../version.version.compile.pass.cpp | 32 ++++++-------------
3 files changed, 13 insertions(+), 25 deletions(-)
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 7cd20acc6ff4a..99c9348ba0c2c 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -346,7 +346,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_optional`` ``202110L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_out_ptr`` *unimplemented*
+ ``__cpp_lib_out_ptr`` ``202106L``
---------------------------------------------------------- -----------------
``__cpp_lib_print`` ``202207L``
---------------------------------------------------------- -----------------
@@ -448,7 +448,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_optional_range_support`` *unimplemented*
---------------------------------------------------------- -----------------
- ``__cpp_lib_out_ptr`` *unimplemented*
+ ``__cpp_lib_out_ptr`` ``202311L``
---------------------------------------------------------- -----------------
``__cpp_lib_philox_engine`` *unimplemented*
---------------------------------------------------------- -----------------
diff --git a/libcxx/include/version b/libcxx/include/version
index 802ffa5a3b7e9..0a01e8a15f01d 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -532,7 +532,7 @@ __cpp_lib_void_t 201411L <type_traits>
// # define __cpp_lib_linalg 202311L
// # define __cpp_lib_optional_range_support 202406L
# undef __cpp_lib_out_ptr
-// # define __cpp_lib_out_ptr 202311L
+# define __cpp_lib_out_ptr 202311L
// # define __cpp_lib_philox_engine 202406L
// # define __cpp_lib_ranges_concat 202403L
# define __cpp_lib_ratio 202306L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index aa5ff80afb56a..df25b552299a1 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -5540,17 +5540,11 @@
# error "__cpp_lib_optional_range_support should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++23"
-# endif
-# if __cpp_lib_out_ptr != 202106L
-# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++23"
+# endif
+# if __cpp_lib_out_ptr != 202106L
+# error "__cpp_lib_out_ptr should have the value 202106L in c++23"
# endif
# if !defined(_LIBCPP_VERSION)
@@ -7381,17 +7375,11 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should be defined in c++26"
-# endif
-# if __cpp_lib_out_ptr != 202311L
-# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
-# endif
-# else // _LIBCPP_VERSION
-# ifdef __cpp_lib_out_ptr
-# error "__cpp_lib_out_ptr should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_out_ptr
+# error "__cpp_lib_out_ptr should be defined in c++26"
+# endif
+# if __cpp_lib_out_ptr != 202311L
+# error "__cpp_lib_out_ptr should have the value 202311L in c++26"
# endif
# if !defined(_LIBCPP_VERSION)
>From 8fcbddc70267bcbd31bfc4646dc2aa3643a82c7f Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hristo.goshev.hristov at gmail.com>
Date: Wed, 10 Jul 2024 22:45:37 +0300
Subject: [PATCH 25/35] Update libcxx/docs/Status/Cxx23Issues.csv
---
libcxx/docs/Status/Cxx23Issues.csv | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libcxx/docs/Status/Cxx23Issues.csv b/libcxx/docs/Status/Cxx23Issues.csv
index 1ebc7939c89c0..547d38c25c1da 100644
--- a/libcxx/docs/Status/Cxx23Issues.csv
+++ b/libcxx/docs/Status/Cxx23Issues.csv
@@ -282,9 +282,7 @@
"`3645 <https://wg21.link/LWG3645>`__","``resize_and_overwrite`` is overspecified to call its callback with lvalues","February 2023","|Complete|","14.0",""
"`3655 <https://wg21.link/LWG3655>`__","The ``INVOKE`` operation and union types","February 2023","|Complete|","18.0",""
"`3723 <https://wg21.link/LWG3723>`__","``priority_queue::push_range`` needs to ``append_range``","February 2023","","","|ranges|"
-"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","|Complete|","18.0",""
-"`3772 <https://wg21.link/LWG3772>`__","``repeat_view``'s ``piecewise`` constructor is missing Postconditions","February 2023","","","|ranges|"
-"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","","",""
+"`3734 <https://wg21.link/LWG3734>`__","Inconsistency in ``inout_ptr`` and ``out_ptr`` for empty case","February 2023","|Complete|","19.0",""
"`3772 <https://wg21.link/LWG3772>`__","``repeat_view``'s ``piecewise`` constructor is missing Postconditions","February 2023","|Complete|","17.0","|ranges|"
"`3786 <https://wg21.link/LWG3786>`__","Flat maps' deduction guide needs to default ``Allocator`` to be useful","February 2023","","",""
"`3803 <https://wg21.link/LWG3803>`__","``flat_foo`` constructors taking ``KeyContainer`` lack ``KeyCompare`` parameter","February 2023","","",""
>From 34387e27500acb842083e38f86a7fd36a25f3958 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 10 Jul 2024 23:09:11 +0300
Subject: [PATCH 26/35] Fixed formatting
---
libcxx/test/std/utilities/smartptr/adapt/types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 3d8513084bd90..50a4c73eef00e 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -73,7 +73,7 @@ static_assert(std::is_constructible_v< ResettablePtr<int>, int* >);
template <typename _Tp>
struct NonConstructiblePtr : public ResettablePtr<_Tp> {
- NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr){};
+ NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr) {};
void reset(_Tp* p) { ResettablePtr<_Tp>::ptr.reset(p); }
};
>From 39696594bdd1366f08c4baa573da4126b43a7677 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Fri, 12 Jul 2024 06:52:23 +0300
Subject: [PATCH 27/35] Fixed *.verify.cpp tests
---
.../std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp | 2 +-
.../utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp | 2 +-
.../std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp | 2 +-
.../std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
index a5dabb92ab683..09ac210288a32 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
@@ -24,7 +24,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
+ // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr>': std::shared_ptr<> is not supported}}
std::ignore = std::inout_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::inout_ptr_t<shared_ptr<int>, _Ptr>' (aka 'inout_ptr_t<std::shared_ptr<int>, int *>'}}
std::ignore = std::inout_ptr<int*>(sPtr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
index 33cc55520bb40..8a016418e7cff 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr>'{{.*}}std::shared_ptr<> is not supported}}
+ // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr>': std::shared_ptr<> is not supported}}
std::inout_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index 5796a55561ef7..b8884a4a14aaa 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -24,7 +24,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr> || sizeof...(_Args) > 0': Specialization of std::shared_ptr<> requires a deleter.}}
std::ignore = std::out_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<shared_ptr<int>, _Ptr>' (aka 'out_ptr_t<std::shared_ptr<int>, int *>')}}
std::ignore = std::out_ptr<int*>(sPtr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
index c89007b77ae82..7e2e174f216cf 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{{{(static_assert|static assertion)}} failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, std::shared_ptr> || sizeof...(_Args) > 0'{{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr> || sizeof...(_Args) > 0': Specialization of std::shared_ptr<> requires a deleter.}}
std::out_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
>From d4eed77320062998c91bf5d6df335d08a96023fb Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Fri, 12 Jul 2024 14:25:40 +0300
Subject: [PATCH 28/35] Try to fix CI
---
.../std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp | 2 +-
.../utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp | 2 +-
.../std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp | 2 +-
.../std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
index 09ac210288a32..d6d70782c5eb5 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.verify.cpp
@@ -24,7 +24,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr>': std::shared_ptr<> is not supported}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}std::shared_ptr<> is not supported}}
std::ignore = std::inout_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::inout_ptr_t<shared_ptr<int>, _Ptr>' (aka 'inout_ptr_t<std::shared_ptr<int>, int *>'}}
std::ignore = std::inout_ptr<int*>(sPtr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
index 8a016418e7cff..e7557a536c3ed 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr>': std::shared_ptr<> is not supported}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}std::shared_ptr<> is not supported}}
std::inout_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index b8884a4a14aaa..ea39e606c826e 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -24,7 +24,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr> || sizeof...(_Args) > 0': Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
std::ignore = std::out_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<shared_ptr<int>, _Ptr>' (aka 'out_ptr_t<std::shared_ptr<int>, int *>')}}
std::ignore = std::out_ptr<int*>(sPtr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
index 7e2e174f216cf..e53afa5171cba 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error@*:* {{static assertion failed due to requirement '!__is_specialization_v<std::shared_ptr<int>, shared_ptr> || sizeof...(_Args) > 0': Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
std::out_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
>From d46ef500dce5313472ed6d38b4d90c1220b4a9e2 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Mon, 15 Jul 2024 21:28:24 +0300
Subject: [PATCH 29/35] Addressed some feedback
---
libcxx/include/__memory/inout_ptr.h | 2 +-
libcxx/include/__memory/out_ptr.h | 2 +-
libcxx/include/libcxx.imp | 874 ------------------
.../adapt/inout_ptr/inout_ptr_t.verify.cpp | 2 +-
.../smartptr/adapt/out_ptr/out_ptr.verify.cpp | 2 +-
.../adapt/out_ptr/out_ptr_t.verify.cpp | 2 +-
.../test/std/utilities/smartptr/adapt/types.h | 30 +-
7 files changed, 20 insertions(+), 894 deletions(-)
delete mode 100644 libcxx/include/libcxx.imp
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index b49940ca8bc25..04ba6a8a72ea8 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -35,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Smart, class _Pointer, class... _Args>
class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
- static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported");
+ static_assert(!__is_specialization_v<_Smart, shared_ptr>, "std::shared_ptr<> is not supported with std::inout_ptr.");
public:
_LIBCPP_HIDE_FROM_ABI explicit inout_ptr_t(_Smart& __smart, _Args... __args)
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 95a8b8a6fe83e..139a181841e4a 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -35,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Smart, class _Pointer, class... _Args>
class _LIBCPP_TEMPLATE_VIS out_ptr_t {
static_assert(!__is_specialization_v<_Smart, shared_ptr> || sizeof...(_Args) > 0,
- "Specialization of std::shared_ptr<> requires a deleter.");
+ "Using std::shared_ptr<> without a deleter in std::out_ptr is not supported.");
public:
_LIBCPP_HIDE_FROM_ABI explicit out_ptr_t(_Smart& __smart, _Args... __args)
diff --git a/libcxx/include/libcxx.imp b/libcxx/include/libcxx.imp
deleted file mode 100644
index 85cec4d61357b..0000000000000
--- a/libcxx/include/libcxx.imp
+++ /dev/null
@@ -1,874 +0,0 @@
-[
- { include: [ "<__algorithm/adjacent_find.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/all_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/any_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/binary_search.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/clamp.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/comp.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/comp_ref_type.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/copy_backward.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/copy_move_common.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/copy_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/count.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/count_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/equal.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/equal_range.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/fill.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/fill_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find_end.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find_first_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find_if_not.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/find_segment_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/fold.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/for_each.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/for_each_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/for_each_segment.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/generate.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/generate_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/half_positive.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_found_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_fun_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_in_out_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_in_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_out_out_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/in_out_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/includes.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/inplace_merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_heap_until.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_partitioned.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_sorted.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/is_sorted_until.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/iter_swap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/iterator_operations.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/lexicographical_compare.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/lexicographical_compare_three_way.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/lower_bound.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/make_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/make_projected.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/max.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/max_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/min.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/min_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/min_max_result.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/minmax.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/minmax_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/mismatch.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/move.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/move_backward.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/next_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/none_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/nth_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/partial_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/partial_sort_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/partition.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/partition_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/partition_point.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pop_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/prev_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_any_all_none_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backend.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backend.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/any_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/backend.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/fill.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/find_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/for_each.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/libdispatch.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/serial.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/stable_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/thread.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/transform.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_backends/cpu_backends/transform_reduce.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_count.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_equal.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_fill.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_find.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_for_each.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_frontend_dispatch.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_generate.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_is_partitioned.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_move.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_replace.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_rotate_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_stable_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/pstl_transform.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/push_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_adjacent_find.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_all_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_any_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_binary_search.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_clamp.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_contains.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_contains_subrange.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_copy_backward.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_copy_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_count.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_count_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_ends_with.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_equal.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_equal_range.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_fill.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_fill_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_find.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_find_end.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_find_first_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_find_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_find_if_not.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_for_each.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_for_each_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_generate.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_generate_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_includes.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_inplace_merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_heap_until.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_partitioned.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_sorted.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_is_sorted_until.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_iterator_concept.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_lexicographical_compare.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_lower_bound.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_make_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_max.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_max_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_merge.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_min.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_min_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_minmax.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_minmax_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_mismatch.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_move.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_move_backward.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_next_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_none_of.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_nth_element.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_partial_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_partial_sort_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_partition.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_partition_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_partition_point.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_pop_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_prev_permutation.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_push_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_remove.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_remove_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_remove_copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_remove_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_replace.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_replace_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_replace_copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_replace_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_reverse.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_reverse_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_rotate.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_rotate_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_sample.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_search.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_search_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_set_difference.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_set_intersection.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_set_symmetric_difference.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_set_union.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_shuffle.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_sort_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_stable_partition.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_stable_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_starts_with.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_swap_ranges.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_transform.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_unique.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_unique_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/ranges_upper_bound.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/remove.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/remove_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/remove_copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/remove_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/replace.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/replace_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/replace_copy_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/replace_if.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/reverse.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/reverse_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/rotate.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/rotate_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/sample.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/search.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/search_n.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/set_difference.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/set_intersection.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/set_symmetric_difference.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/set_union.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/shift_left.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/shift_right.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/shuffle.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/sift_down.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/sort_heap.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/stable_partition.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/stable_sort.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/swap_ranges.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/three_way_comp_ref_type.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/transform.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/uniform_random_bit_generator_adaptor.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/unique.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/unique_copy.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/unwrap_iter.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/unwrap_range.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__algorithm/upper_bound.h>", "private", "<algorithm>", "public" ] },
- { include: [ "<__atomic/aliases.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic_base.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic_flag.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic_init.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic_lock_free.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/atomic_sync.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/check_memory_order.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/contention_t.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/cxx_atomic_impl.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/fence.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/is_always_lock_free.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/kill_dependency.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__atomic/memory_order.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__bit/bit_cast.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/bit_ceil.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/bit_floor.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/bit_log2.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/bit_width.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/blsr.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/byteswap.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/countl.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/countr.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/endian.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/has_single_bit.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/invert_if.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/popcount.h>", "private", "<bit>", "public" ] },
- { include: [ "<__bit/rotate.h>", "private", "<bit>", "public" ] },
- { include: [ "<__charconv/chars_format.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/from_chars_integral.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/from_chars_result.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/tables.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/to_chars.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/to_chars_base_10.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/to_chars_floating_point.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/to_chars_integral.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/to_chars_result.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__charconv/traits.h>", "private", "<charconv>", "public" ] },
- { include: [ "<__chrono/calendar.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/concepts.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/convert_to_timespec.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/convert_to_tm.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/day.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/duration.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/file_clock.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/formatter.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/hh_mm_ss.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/high_resolution_clock.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/literals.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/month.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/month_weekday.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/monthday.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/ostream.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/parser_std_format_spec.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/statically_widen.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/steady_clock.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/system_clock.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/time_point.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/time_zone.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/time_zone_link.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/tzdb.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/tzdb_list.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/weekday.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/year.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/year_month.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/year_month_day.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__chrono/year_month_weekday.h>", "private", "<chrono>", "public" ] },
- { include: [ "<__compare/common_comparison_category.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/compare_partial_order_fallback.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/compare_strong_order_fallback.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/compare_three_way.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/compare_three_way_result.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/compare_weak_order_fallback.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/is_eq.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/ordering.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/partial_order.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/strong_order.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/synth_three_way.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/three_way_comparable.h>", "private", "<compare>", "public" ] },
- { include: [ "<__compare/weak_order.h>", "private", "<compare>", "public" ] },
- { include: [ "<__concepts/arithmetic.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/assignable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/boolean_testable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/class_or_enum.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/common_reference_with.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/common_with.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/constructible.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/convertible_to.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/copyable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/derived_from.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/destructible.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/different_from.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/equality_comparable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/invocable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/movable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/predicate.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/regular.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/relation.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/same_as.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/semiregular.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/swappable.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__concepts/totally_ordered.h>", "private", "<concepts>", "public" ] },
- { include: [ "<__condition_variable/condition_variable.h>", "private", "<condition_variable>", "public" ] },
- { include: [ "<__coroutine/coroutine_handle.h>", "private", "<coroutine>", "public" ] },
- { include: [ "<__coroutine/coroutine_traits.h>", "private", "<coroutine>", "public" ] },
- { include: [ "<__coroutine/noop_coroutine_handle.h>", "private", "<coroutine>", "public" ] },
- { include: [ "<__coroutine/trivial_awaitables.h>", "private", "<coroutine>", "public" ] },
- { include: [ "<__exception/exception.h>", "private", "<exception>", "public" ] },
- { include: [ "<__exception/exception_ptr.h>", "private", "<exception>", "public" ] },
- { include: [ "<__exception/nested_exception.h>", "private", "<exception>", "public" ] },
- { include: [ "<__exception/operations.h>", "private", "<exception>", "public" ] },
- { include: [ "<__exception/terminate.h>", "private", "<exception>", "public" ] },
- { include: [ "<__expected/bad_expected_access.h>", "private", "<expected>", "public" ] },
- { include: [ "<__expected/expected.h>", "private", "<expected>", "public" ] },
- { include: [ "<__expected/unexpect.h>", "private", "<expected>", "public" ] },
- { include: [ "<__expected/unexpected.h>", "private", "<expected>", "public" ] },
- { include: [ "<__filesystem/copy_options.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/directory_entry.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/directory_iterator.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/directory_options.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/file_status.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/file_time_type.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/file_type.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/filesystem_error.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/operations.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/path.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/path_iterator.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/perm_options.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/perms.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/recursive_directory_iterator.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/space_info.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__filesystem/u8path.h>", "private", "<filesystem>", "public" ] },
- { include: [ "<__format/buffer.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/concepts.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/container_adaptor.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/enable_insertable.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/escaped_output_table.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/extended_grapheme_cluster_table.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_arg.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_arg_store.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_args.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_context.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_error.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_functions.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_fwd.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_parse_context.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_string.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/format_to_n_result.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_bool.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_char.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_floating_point.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_integer.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_integral.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_output.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_pointer.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_string.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/formatter_tuple.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/parser_std_format_spec.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/range_default_formatter.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/range_formatter.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/unicode.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/width_estimation_table.h>", "private", "<format>", "public" ] },
- { include: [ "<__format/write_escaped.h>", "private", "<format>", "public" ] },
- { include: [ "<__functional/binary_function.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/binary_negate.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/bind.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/bind_back.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/bind_front.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/binder1st.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/binder2nd.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/boyer_moore_searcher.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/compose.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/default_searcher.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/function.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/hash.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/identity.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/invoke.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/is_transparent.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/mem_fn.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/mem_fun_ref.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/not_fn.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/operations.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/perfect_forward.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/pointer_to_binary_function.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/pointer_to_unary_function.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/ranges_operations.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/reference_wrapper.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/unary_function.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/unary_negate.h>", "private", "<functional>", "public" ] },
- { include: [ "<__functional/weak_result_type.h>", "private", "<functional>", "public" ] },
- { include: [ "<__fwd/array.h>", "private", "<array>", "public" ] },
- { include: [ "<__fwd/bit_reference.h>", "private", "<bitset>", "public" ] },
- { include: [ "<__fwd/bit_reference.h>", "private", "<vector>", "public" ] },
- { include: [ "<__fwd/complex.h>", "private", "<complex>", "public" ] },
- { include: [ "<__fwd/fstream.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/hash.h>", "private", "<functional>", "public" ] },
- { include: [ "<__fwd/ios.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/istream.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/mdspan.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__fwd/memory_resource.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__fwd/ostream.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/pair.h>", "private", "<utility>", "public" ] },
- { include: [ "<__fwd/span.h>", "private", "<span>", "public" ] },
- { include: [ "<__fwd/sstream.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/streambuf.h>", "private", "<iosfwd>", "public" ] },
- { include: [ "<__fwd/string.h>", "private", "<string>", "public" ] },
- { include: [ "<__fwd/string_view.h>", "private", "<string_view>", "public" ] },
- { include: [ "<__fwd/subrange.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__fwd/tuple.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__ios/fpos.h>", "private", "<ios>", "public" ] },
- { include: [ "<__iterator/access.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/advance.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/back_insert_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/bounded_iter.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/common_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/concepts.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/counted_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/cpp17_iterator_concepts.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/data.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/default_sentinel.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/distance.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/empty.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/erase_if_container.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/front_insert_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/incrementable_traits.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/indirectly_comparable.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/insert_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/istream_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/istreambuf_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/iter_move.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/iter_swap.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/iterator_traits.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/iterator_with_data.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/mergeable.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/move_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/move_sentinel.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/next.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/ostream_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/ostreambuf_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/permutable.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/prev.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/projected.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/ranges_iterator_traits.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/readable_traits.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/reverse_access.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/reverse_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/segmented_iterator.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/size.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/sortable.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/unreachable_sentinel.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__iterator/wrap_iter.h>", "private", "<iterator>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/android.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/bsd_locale_defaults.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/bsd_locale_fallbacks.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/fuchsia.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/ibm.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/locale_guard.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/musl.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/newlib.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/openbsd.h>", "private", "<locale>", "public" ] },
- { include: [ "<__locale_dir/locale_base_api/win32.h>", "private", "<locale>", "public" ] },
- { include: [ "<__math/abs.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/copysign.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/error_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/exponential_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/fdim.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/fma.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/gamma.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/hyperbolic_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/hypot.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/inverse_hyperbolic_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/inverse_trigonometric_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/logarithms.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/min_max.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/modulo.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/remainder.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/roots.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/rounding_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/traits.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__math/trigonometric_functions.h>", "private", "<cmath>", "public" ] },
- { include: [ "<__mdspan/default_accessor.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__mdspan/extents.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__mdspan/layout_left.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__mdspan/layout_right.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__mdspan/layout_stride.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__mdspan/mdspan.h>", "private", "<mdspan>", "public" ] },
- { include: [ "<__memory/addressof.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/align.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/aligned_alloc.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocate_at_least.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocation_guard.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocator.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocator_arg_t.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocator_destructor.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/allocator_traits.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/assume_aligned.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/auto_ptr.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/builtin_new_allocator.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/compressed_pair.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/concepts.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/construct_at.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/destruct_n.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/inout_ptr.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/out_ptr.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/pointer_traits.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/ranges_construct_at.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/ranges_uninitialized_algorithms.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/raw_storage_iterator.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/shared_ptr.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/swap_allocator.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/temp_value.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/temporary_buffer.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/uninitialized_algorithms.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/unique_ptr.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/uses_allocator.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/uses_allocator_construction.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory/voidify.h>", "private", "<memory>", "public" ] },
- { include: [ "<__memory_resource/memory_resource.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__memory_resource/monotonic_buffer_resource.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__memory_resource/polymorphic_allocator.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__memory_resource/pool_options.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__memory_resource/synchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__memory_resource/unsynchronized_pool_resource.h>", "private", "<memory_resource>", "public" ] },
- { include: [ "<__mutex/lock_guard.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__mutex/mutex.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__mutex/once_flag.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__mutex/tag_types.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__mutex/unique_lock.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__numeric/accumulate.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/adjacent_difference.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/exclusive_scan.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/gcd_lcm.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/inclusive_scan.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/inner_product.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/iota.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/midpoint.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/partial_sum.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/pstl_reduce.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/pstl_transform_reduce.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/reduce.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/saturation_arithmetic.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/transform_exclusive_scan.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/transform_inclusive_scan.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__numeric/transform_reduce.h>", "private", "<numeric>", "public" ] },
- { include: [ "<__random/bernoulli_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/binomial_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/cauchy_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/chi_squared_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/clamp_to_integral.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/default_random_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/discard_block_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/discrete_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/exponential_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/extreme_value_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/fisher_f_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/gamma_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/generate_canonical.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/geometric_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/independent_bits_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/is_seed_sequence.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/is_valid.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/knuth_b.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/linear_congruential_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/log2.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/lognormal_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/mersenne_twister_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/negative_binomial_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/normal_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/piecewise_constant_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/piecewise_linear_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/poisson_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/random_device.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/ranlux.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/seed_seq.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/shuffle_order_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/student_t_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/subtract_with_carry_engine.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/uniform_int_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/uniform_random_bit_generator.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/uniform_real_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__random/weibull_distribution.h>", "private", "<random>", "public" ] },
- { include: [ "<__ranges/access.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/all.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/as_rvalue_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/chunk_by_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/common_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/concepts.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/container_compatible_range.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/counted.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/dangling.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/data.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/drop_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/drop_while_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/elements_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/empty.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/empty_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/enable_borrowed_range.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/enable_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/filter_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/from_range.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/iota_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/istream_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/join_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/lazy_split_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/movable_box.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/non_propagating_cache.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/owning_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/range_adaptor.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/rbegin.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/ref_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/rend.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/repeat_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/reverse_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/single_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/size.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/split_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/subrange.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/take_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/take_while_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/to.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/transform_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/view_interface.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/views.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__ranges/zip_view.h>", "private", "<ranges>", "public" ] },
- { include: [ "<__stop_token/atomic_unique_lock.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/intrusive_list_view.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/intrusive_shared_ptr.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/stop_callback.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/stop_source.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/stop_state.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__stop_token/stop_token.h>", "private", "<stop_token>", "public" ] },
- { include: [ "<__string/char_traits.h>", "private", "<string>", "public" ] },
- { include: [ "<__string/constexpr_c_functions.h>", "private", "<string>", "public" ] },
- { include: [ "<__string/extern_template_lists.h>", "private", "<string>", "public" ] },
- { include: [ "<__system_error/errc.h>", "private", "<system_error>", "public" ] },
- { include: [ "<__system_error/error_category.h>", "private", "<system_error>", "public" ] },
- { include: [ "<__system_error/error_code.h>", "private", "<system_error>", "public" ] },
- { include: [ "<__system_error/error_condition.h>", "private", "<system_error>", "public" ] },
- { include: [ "<__system_error/system_error.h>", "private", "<system_error>", "public" ] },
- { include: [ "<__thread/formatter.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/id.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/jthread.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/poll_with_backoff.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/support.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__thread/support.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__thread/support.h>", "private", "<semaphore>", "public" ] },
- { include: [ "<__thread/support.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/support/c11.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__thread/support/c11.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__thread/support/c11.h>", "private", "<semaphore>", "public" ] },
- { include: [ "<__thread/support/c11.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/support/external.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__thread/support/external.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__thread/support/external.h>", "private", "<semaphore>", "public" ] },
- { include: [ "<__thread/support/external.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/support/pthread.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__thread/support/pthread.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__thread/support/pthread.h>", "private", "<semaphore>", "public" ] },
- { include: [ "<__thread/support/pthread.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/support/windows.h>", "private", "<atomic>", "public" ] },
- { include: [ "<__thread/support/windows.h>", "private", "<mutex>", "public" ] },
- { include: [ "<__thread/support/windows.h>", "private", "<semaphore>", "public" ] },
- { include: [ "<__thread/support/windows.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/this_thread.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/thread.h>", "private", "<thread>", "public" ] },
- { include: [ "<__thread/timed_backoff_policy.h>", "private", "<thread>", "public" ] },
- { include: [ "<__tuple/make_tuple_types.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/pair_like.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/sfinae_helpers.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_element.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_indices.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_like.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_like_ext.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_size.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__tuple/tuple_types.h>", "private", "<tuple>", "public" ] },
- { include: [ "<__type_traits/add_const.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/add_cv.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/add_lvalue_reference.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/add_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/add_rvalue_reference.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/add_volatile.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/aligned_storage.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/aligned_union.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/alignment_of.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/apply_cv.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/can_extract_key.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/common_reference.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/common_type.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/conditional.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/conjunction.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/copy_cv.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/copy_cvref.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/datasizeof.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/decay.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/dependent_type.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/disjunction.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/enable_if.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/extent.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/has_unique_object_representation.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/has_virtual_destructor.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/integral_constant.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/invoke.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_abstract.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_aggregate.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_allocator.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_always_bitcastable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_arithmetic.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_array.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_base_of.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_bounded_array.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_callable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_char_like_type.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_class.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_compound.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_const.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_constant_evaluated.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_convertible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_copy_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_copy_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_core_convertible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_default_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_destructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_empty.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_enum.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_equality_comparable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_execution_policy.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_final.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_floating_point.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_function.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_fundamental.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_implicitly_default_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_integral.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_literal_type.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_member_function_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_member_object_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_member_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_move_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_move_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_convertible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_copy_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_copy_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_default_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_destructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_move_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_nothrow_move_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_null_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_object.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_pod.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_polymorphic.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_primary_template.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_reference.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_reference_wrapper.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_referenceable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_same.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_scalar.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_scoped_enum.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_signed.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_signed_integer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_specialization.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_standard_layout.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_swappable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivial.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_copy_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_copy_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_copyable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_default_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_destructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_lexicographically_comparable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_move_assignable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_move_constructible.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_trivially_relocatable.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_unbounded_array.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_union.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_unsigned.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_unsigned_integer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_valid_expansion.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_void.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/is_volatile.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/lazy.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/make_32_64_or_128_bit.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/make_const_lvalue_ref.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/make_signed.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/make_unsigned.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/maybe_const.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/nat.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/negation.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/noexcept_move_assign_container.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/operation_traits.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/promote.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/rank.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_all_extents.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_const.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_const_ref.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_cv.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_cvref.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_extent.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_pointer.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_reference.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/remove_volatile.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/result_of.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/strip_signature.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/type_identity.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/type_list.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/underlying_type.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/unwrap_ref.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__type_traits/void_t.h>", "private", "<type_traits>", "public" ] },
- { include: [ "<__utility/as_const.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/as_lvalue.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/auto_cast.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/cmp.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/convert_to_integral.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/declval.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/empty.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/exception_guard.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/exchange.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/forward.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/forward_like.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/in_place.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/integer_sequence.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/is_pointer_in_range.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/move.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/no_destroy.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/pair.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/piecewise_construct.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/priority_tag.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/rel_ops.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/small_buffer.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/swap.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/to_underlying.h>", "private", "<utility>", "public" ] },
- { include: [ "<__utility/unreachable.h>", "private", "<utility>", "public" ] },
- { include: [ "<__variant/monostate.h>", "private", "<variant>", "public" ] },
-]
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
index e7557a536c3ed..2270c4c3fc785 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}std::shared_ptr<> is not supported}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}std::shared_ptr<> is not supported with std::inout_ptr.}}
std::inout_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
index ea39e606c826e..1fe78ecb22789 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.verify.cpp
@@ -24,7 +24,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Using std::shared_ptr<> without a deleter in std::out_ptr is not supported.}}
std::ignore = std::out_ptr(sPtr);
// expected-error@*:* {{no matching conversion for functional-style cast from 'std::shared_ptr<int>' to 'std::out_ptr_t<shared_ptr<int>, _Ptr>' (aka 'out_ptr_t<std::shared_ptr<int>, int *>')}}
std::ignore = std::out_ptr<int*>(sPtr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
index e53afa5171cba..cbe96e752ac92 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.verify.cpp
@@ -21,7 +21,7 @@ int main(int, char**) {
{
std::shared_ptr<int> sPtr;
- // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Specialization of std::shared_ptr<> requires a deleter.}}
+ // expected-error-re@*:* {{static assertion failed due to requirement {{.*}}Using std::shared_ptr<> without a deleter in std::out_ptr is not supported.}}
std::out_ptr_t<std::shared_ptr<int>, int*>{sPtr};
}
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 50a4c73eef00e..d55af1f84062c 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -29,15 +29,15 @@ struct MoveOnlyDeleter {
// Custom pointer types.
-template <typename _Tp>
+template <typename T>
struct ConstructiblePtr {
- using pointer = _Tp*;
- std::unique_ptr<_Tp> ptr;
+ using pointer = T*;
+ std::unique_ptr<T> ptr;
ConstructiblePtr() = default;
- explicit ConstructiblePtr(_Tp* p) : ptr{p} {}
+ explicit ConstructiblePtr(T* p) : ptr{p} {}
- auto operator==(_Tp val) { return *ptr == val; }
+ auto operator==(T val) { return *ptr == val; }
auto* get() const { return ptr.get(); }
@@ -49,19 +49,19 @@ static_assert(std::is_constructible_v< ConstructiblePtr<int>, int* >);
struct ResetArg {};
-template <typename _Tp>
+template <typename T>
struct ResettablePtr {
- using element_type = _Tp;
- std::unique_ptr<_Tp> ptr;
+ using element_type = T;
+ std::unique_ptr<T> ptr;
- explicit ResettablePtr(_Tp* p) : ptr{p} {}
+ explicit ResettablePtr(T* p) : ptr{p} {}
auto operator*() const { return *ptr; }
- auto operator==(_Tp val) { return *ptr == val; }
+ auto operator==(T val) { return *ptr == val; }
void reset() { ptr.reset(); }
- void reset(_Tp* p, ResetArg) { ptr.reset(p); }
+ void reset(T* p, ResetArg) { ptr.reset(p); }
auto* get() const { return ptr.get(); }
@@ -71,11 +71,11 @@ struct ResettablePtr {
static_assert(std::is_same_v<std::__pointer_of_t< ResettablePtr<int>>, int* >);
static_assert(std::is_constructible_v< ResettablePtr<int>, int* >);
-template <typename _Tp>
-struct NonConstructiblePtr : public ResettablePtr<_Tp> {
- NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr) {};
+template <typename T>
+struct NonConstructiblePtr : public ResettablePtr<T> {
+ NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr){};
- void reset(_Tp* p) { ResettablePtr<_Tp>::ptr.reset(p); }
+ void reset(T* p) { ResettablePtr<T>::ptr.reset(p); }
};
static_assert(std::is_same_v<std::__pointer_of_t< NonConstructiblePtr<int>>, int* >);
>From b0d04139c9dc85051adb97f5e41e49b478977e2d Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Mon, 15 Jul 2024 21:38:59 +0300
Subject: [PATCH 30/35] Try to fix CI
---
libcxx/test/std/utilities/smartptr/adapt/types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index d55af1f84062c..8a08550e3e447 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -73,7 +73,7 @@ static_assert(std::is_constructible_v< ResettablePtr<int>, int* >);
template <typename T>
struct NonConstructiblePtr : public ResettablePtr<T> {
- NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr){};
+ NonConstructiblePtr() : NonConstructiblePtr::ResettablePtr(nullptr) {};
void reset(T* p) { ResettablePtr<T>::ptr.reset(p); }
};
>From 4d9dc5e71d12411082909804b2e465d9f2dc67b4 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 17 Jul 2024 11:37:17 +0300
Subject: [PATCH 31/35] Added comments to tests in plain English
---
.../adapt/inout_ptr/inout_ptr.general.pass.cpp | 10 ++++++++++
.../smartptr/adapt/out_ptr/out_ptr.general.pass.cpp | 8 ++++++++
2 files changed, 18 insertions(+)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
index 312df25c40c0f..d55a0c2abd464 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr.general.pass.cpp
@@ -20,6 +20,8 @@
#include "../types.h"
+// Test updating the ownership of an `inout_ptr_t`-managed pointer for an API with a non-void pointer type.
+// The API returns a new valid object.
void test_replace_int_p() {
auto replace_int_p = [](int** pp) {
assert(**pp == 90);
@@ -81,6 +83,8 @@ void test_replace_int_p() {
}
}
+// Test updating the ownership of an `inout_ptr_t`-managed pointer for an API with a non-void pointer type.
+// The API returns `nullptr`.
void test_replace_int_p_with_nullptr() {
auto replace_int_p_with_nullptr = [](int** pp) -> void {
assert(**pp == 90);
@@ -107,6 +111,8 @@ void test_replace_int_p_with_nullptr() {
}
}
+// Test updating the ownership of an `inout_ptr_t`-managed pointer for an API with a void pointer type.
+// The API returns a new valid object.
void test_replace_int_void_p() {
auto replace_int_void_p = [](void** pp) {
assert(*(static_cast<int*>(*pp)) == 90);
@@ -134,6 +140,8 @@ void test_replace_int_void_p() {
}
}
+// Test updating the ownership of an `inout_ptr_t`-managed pointer for an API with a non-void pointer type.
+// The API returns `nullptr`.
void test_replace_int_void_p_with_nullptr() {
auto replace_int_void_p_with_nullptr = [](void** pp) {
assert(*(static_cast<int*>(*pp)) == 90);
@@ -159,6 +167,8 @@ void test_replace_int_void_p_with_nullptr() {
}
}
+// Test updating the ownership of an `inout_ptr_t`-managed pointer for an API with a void pointer type.
+// The API returns a new valid object.
void test_replace_nullptr_with_int_p() {
auto replace_nullptr_with_int_p = [](int** pp) {
assert(*pp == nullptr);
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
index 6d2065dcc2b36..a78e22f69abc0 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr.general.pass.cpp
@@ -20,6 +20,8 @@
#include "../types.h"
+// Test updating an `out_ptr_t`-managed pointer for an API with a non-void pointer type.
+// The API returns a new valid object.
void test_get_int_p() {
auto get_int_p = [](int** pp) { *pp = new int{84}; };
@@ -87,6 +89,8 @@ void test_get_int_p() {
}
}
+// Test updating an `out_ptr_t`-managed pointer for an API with a non-void pointer type.
+// The API returns `nullptr`.
void test_get_int_p_nullptr() {
auto get_int_p_nullptr = [](int** pp) { *pp = nullptr; };
// raw pointer
@@ -120,6 +124,8 @@ void test_get_int_p_nullptr() {
}
}
+// Test updating an `out_ptr_t`-managed pointer for an API with a void pointer type.
+// The API returns a new valid object.
void test_get_int_void_p() {
auto get_int_void_p = [](void** pp) { *(reinterpret_cast<int**>(pp)) = new int{84}; };
@@ -178,6 +184,8 @@ void test_get_int_void_p() {
}
}
+// Test updating an `out_ptr_t`-managed pointer for an API with a void pointer type.
+// The API returns `nullptr`.
void test_get_int_void_p_nullptr() {
auto get_int_void_p_nullptr = [](void** pp) { *pp = nullptr; };
>From 409f66a36d5639588e0b818ea39fc88c45ff320d Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 17 Jul 2024 17:23:45 +0300
Subject: [PATCH 32/35] Added error messages
---
libcxx/include/__memory/inout_ptr.h | 5 +++--
libcxx/include/__memory/out_ptr.h | 8 +++++---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libcxx/include/__memory/inout_ptr.h b/libcxx/include/__memory/inout_ptr.h
index 04ba6a8a72ea8..72e1a21ad6867 100644
--- a/libcxx/include/__memory/inout_ptr.h
+++ b/libcxx/include/__memory/inout_ptr.h
@@ -71,7 +71,8 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else {
- static_assert(is_constructible_v<_Smart, _SP, _Args...>);
+ static_assert(is_constructible_v<_Smart, _SP, _Args...>,
+ "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
}
@@ -82,7 +83,7 @@ class _LIBCPP_TEMPLATE_VIS inout_ptr_t {
_LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
requires(!is_same_v<_Pointer, void*>)
{
- static_assert(is_pointer_v<_Pointer>);
+ static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer.");
return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
}
diff --git a/libcxx/include/__memory/out_ptr.h b/libcxx/include/__memory/out_ptr.h
index 139a181841e4a..95aa2029c9231 100644
--- a/libcxx/include/__memory/out_ptr.h
+++ b/libcxx/include/__memory/out_ptr.h
@@ -46,7 +46,8 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
} else if constexpr (is_constructible_v<_Smart>) {
__s_ = _Smart();
} else {
- static_assert(__resettable_smart_pointer<_Ptr> || is_constructible_v<_Smart>);
+ static_assert(__resettable_smart_pointer<_Ptr> || is_constructible_v<_Smart>,
+ "The adapted pointer type must have a reset() member function or be default constructible.");
}
}
@@ -62,7 +63,8 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
std::apply([&](auto&&... __args) { __s_.reset(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
} else {
- static_assert(is_constructible_v<_Smart, _SP, _Args...>);
+ static_assert(is_constructible_v<_Smart, _SP, _Args...>,
+ "The smart pointer must be constructible from arguments of types _Smart, _Pointer, _Args...");
std::apply([&](auto&&... __args) { __s_ = _Smart(static_cast<_SP>(__p_), std::forward<_Args>(__args)...); },
std::move(__a_));
}
@@ -73,7 +75,7 @@ class _LIBCPP_TEMPLATE_VIS out_ptr_t {
_LIBCPP_HIDE_FROM_ABI operator void**() const noexcept
requires(!is_same_v<_Pointer, void*>)
{
- static_assert(is_pointer_v<_Pointer>);
+ static_assert(is_pointer_v<_Pointer>, "The conversion to void** requires _Pointer to be a raw pointer.");
return reinterpret_cast<void**>(static_cast<_Pointer*>(*this));
}
>From ebe9e9d85fb40cc17525566faef8afecab05175a Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 17 Jul 2024 17:57:11 +0300
Subject: [PATCH 33/35] Added minimal runtime tests
---
.../smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp | 10 ++++++++++
.../smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
index 1def6931441d3..c7e173a76e728 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/inout_ptr/inout_ptr_t.ctor.pass.cpp
@@ -16,6 +16,7 @@
// explicit inout_ptr_t(Smart&, Args...);
+#include <cassert>
#include <memory>
#include "test_convertible.h"
@@ -29,6 +30,9 @@ int main(int, char**) {
static_assert(
!test_convertible<std::inout_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
+
+ // Test the state of the pointer after construction. Complete tests are available in inout_ptr.general.pass.cpp.
+ assert(uPtr == nullptr);
}
{
@@ -39,12 +43,18 @@ int main(int, char**) {
static_assert(!test_convertible<std::inout_ptr_t<std::unique_ptr<int, decltype(deleter)>, int*>>(),
"This constructor must be explicit");
+
+ // Test the state of the pointer after construction. Complete tests are available in inout_ptr.general.pass.cpp.
+ assert(uPtr == nullptr);
}
{
std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr;
std::inout_ptr_t<decltype(uPtr), int*, MoveOnlyDeleter<int>>{uPtr, MoveOnlyDeleter<int>{}};
+
+ // Test the state of the pointer after construction. Complete tests are available in inout_ptr.general.pass.cpp.
+ assert(uPtr == nullptr);
}
return 0;
diff --git a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
index 474ab3c162e90..29e1258845bc9 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
+++ b/libcxx/test/std/utilities/smartptr/adapt/out_ptr/out_ptr_t.ctor.pass.cpp
@@ -16,6 +16,7 @@
// explicit out_ptr_t(Smart&, Args...);
+#include <cassert>
#include <memory>
#include "test_convertible.h"
@@ -28,6 +29,9 @@ int main(int, char**) {
std::out_ptr_t<std::unique_ptr<int>, int*>{uPtr};
static_assert(!test_convertible<std::out_ptr_t<std::unique_ptr<int>, int*>>(), "This constructor must be explicit");
+
+ // Test the state of the pointer after construction. Complete tests are available in out_ptr.general.pass.cpp
+ assert(uPtr == nullptr);
}
{
@@ -37,12 +41,18 @@ int main(int, char**) {
static_assert(!test_convertible<std::out_ptr_t<decltype(uPtr), int*, std::default_delete<int>>>(),
"This constructor must be explicit");
+
+ // Test the state of the pointer after construction. Complete tests are available in out_ptr.general.pass.cpp
+ assert(uPtr == nullptr);
}
{
std::unique_ptr<int, MoveOnlyDeleter<int>> uPtr;
std::out_ptr_t<decltype(uPtr), int*, MoveOnlyDeleter<int>>{uPtr, MoveOnlyDeleter<int>{}};
+
+ // Test the state of the pointer after construction. Complete tests are available in out_ptr.general.pass.cpp
+ assert(uPtr == nullptr);
}
return 0;
>From 5abf091f1a3c3a3d4a3dd514ad516c2d5952b8d7 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 17 Jul 2024 18:02:14 +0300
Subject: [PATCH 34/35] Addressed the final comment
---
libcxx/test/std/utilities/smartptr/adapt/types.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 8a08550e3e447..4f4b5cb326639 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -44,7 +44,7 @@ struct ConstructiblePtr {
void release() { ptr.release(); }
};
-static_assert(std::is_same_v<std::__pointer_of_t< ConstructiblePtr<int>>, int* >);
+LIBCPP_STATIC_ASSERT(std::is_same_v<std::__pointer_of_t< ConstructiblePtr<int>>, int* >);
static_assert(std::is_constructible_v< ConstructiblePtr<int>, int* >);
struct ResetArg {};
@@ -68,7 +68,7 @@ struct ResettablePtr {
void release() { ptr.release(); }
};
-static_assert(std::is_same_v<std::__pointer_of_t< ResettablePtr<int>>, int* >);
+LIBCPP_STATIC_ASSERT(std::is_same_v<std::__pointer_of_t< ResettablePtr<int>>, int* >);
static_assert(std::is_constructible_v< ResettablePtr<int>, int* >);
template <typename T>
@@ -78,7 +78,7 @@ struct NonConstructiblePtr : public ResettablePtr<T> {
void reset(T* p) { ResettablePtr<T>::ptr.reset(p); }
};
-static_assert(std::is_same_v<std::__pointer_of_t< NonConstructiblePtr<int>>, int* >);
+LIBCPP_STATIC_ASSERT(std::is_same_v<std::__pointer_of_t< NonConstructiblePtr<int>>, int* >);
static_assert(!std::is_constructible_v< NonConstructiblePtr<int>, int* >);
#endif // TEST_LIBCXX_UTILITIES_SMARTPTR_ADAPT_TYPES_H
>From 9866adc1d4686dfcdbaa7b9897f8f9bab3604591 Mon Sep 17 00:00:00 2001
From: Hristo Hristov <hghristov.rmm at gmail.com>
Date: Wed, 17 Jul 2024 18:04:27 +0300
Subject: [PATCH 35/35] Fix
---
libcxx/test/std/utilities/smartptr/adapt/types.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libcxx/test/std/utilities/smartptr/adapt/types.h b/libcxx/test/std/utilities/smartptr/adapt/types.h
index 4f4b5cb326639..0da6007ba394f 100644
--- a/libcxx/test/std/utilities/smartptr/adapt/types.h
+++ b/libcxx/test/std/utilities/smartptr/adapt/types.h
@@ -12,6 +12,8 @@
#include <type_traits>
#include <memory>
+#include "test_macros.h"
+
// Custom deleters.
template <typename T>
More information about the libcxx-commits
mailing list