From ca437984784afef5432ee2e72d48c12a6c1d6bee Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sat, 13 Apr 2024 11:39:47 +0100 Subject: [PATCH 01/14] Latest CMake for latest modules support --- conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index 85d24346..4bddf1f2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -130,8 +130,8 @@ def build_requirements(self): self.test_requires("catch2/3.4.0") self.test_requires("gtest/1.14.0") - if get_cmake_version() < Version("3.28.1"): - self.tool_requires("cmake/3.28.1") + if get_cmake_version() < Version("3.29.0"): + self.tool_requires("cmake/3.29.0") if self.options.build_docs: self.build_requires("doxygen/1.9.4") # doxygen/1.9.5 will update dependency on zlib/1.2.12 to zlib/1.2.13 From fba2bc78e429c005b3796c30fd8dd731e1faaed1 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sat, 13 Apr 2024 11:58:07 +0100 Subject: [PATCH 02/14] Add project option for modules support --- CMakeLists.txt | 1 + cmake/compiler.cmake | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 334cbbf0..5cd26496 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ include(GNUInstallDirs) include(CMakeDependentOption) include(CMakePackageConfigHelpers) +cmake_dependent_option(MORPHEUS_MODULES_SUPPORT "Enable building with support for modules" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"MSVC\"" OFF) cmake_dependent_option(MORPHEUS_LINK_WITH_MOLD "Enable the mold linker" ON "LINUX OR APPLE" OFF) cmake_dependent_option(MORPHEUS_CODE_COVERAGE "Enable code coverage" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"Clang\" OR \"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"GNU\"" OFF) cmake_dependent_option(MORPHEUS_INCLUDE_NATVIS "Enable inclusion of a natvis files for debugging" ON "\"${CMAKE_CXX_COMPILER_ID}\" STREQUAL \"MSVC\"" OFF) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 8556d81b..58469bfc 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -35,3 +35,8 @@ target_compile_options(MorpheusConfig $<$:${GCC_WARNINGS}> $<$,$>:${CLANG_WARNINGS}> ) + +target_compile_definitions(MorpheusConfig + INTERFACE + MORPHEUS_MODULES_SUPPORT=$ +) From 23c43b8e4d108f386773f5738be2262dd26b9a23 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sat, 13 Apr 2024 15:55:54 +0100 Subject: [PATCH 03/14] Absolute minimum start for std module --- CMakeLists.txt | 3 ++- cmake/compiler.cmake | 1 + conanfile.py | 3 +++ modules/CMakeLists.txt | 7 +++++ modules/std/CMakeLists.txt | 1 + modules/std/std.compat/CMakeLists.txt | 0 modules/std/std/CMakeLists.txt | 9 +++++++ modules/std/std/cstdint.ixx | 38 +++++++++++++++++++++++++++ modules/std/std/std.ixx | 11 ++++++++ 9 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 modules/CMakeLists.txt create mode 100644 modules/std/CMakeLists.txt create mode 100644 modules/std/std.compat/CMakeLists.txt create mode 100644 modules/std/std/CMakeLists.txt create mode 100644 modules/std/std/cstdint.ixx create mode 100644 modules/std/std/std.ixx diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cd26496..f7ac651c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,9 @@ if(IS_MULTI_CONFIG) endif() #------------------------------------------------------------------------------------------------------------------------------------------ -add_subdirectory(libraries) add_subdirectory(examples) +add_subdirectory(modules) +add_subdirectory(libraries) if (ENABLE_CODE_COVERAGE) enable_code_coverage() diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 58469bfc..d20cca8c 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -26,6 +26,7 @@ add_library(morpheus::config ALIAS MorpheusConfig) target_link_libraries(MorpheusConfig INTERFACE $<$:dl> + std ) target_compile_options(MorpheusConfig diff --git a/conanfile.py b/conanfile.py index 4bddf1f2..b02b602e 100644 --- a/conanfile.py +++ b/conanfile.py @@ -58,6 +58,7 @@ class Morpheus(ConanFile): "fPIC": [True, False], "tools": [True, False], "build_docs": [True, False], + "build_with_modules": [True, False], "link_with_mold": [True, False] } default_options = { @@ -65,6 +66,7 @@ class Morpheus(ConanFile): "fPIC": True, "tools": True, "build_docs": False, + "build_with_modules": False "link_with_mold": True } exports_sources = ["CMakeLists.txt", "LICENSE", "version.txt", "cmake/*", "examples/*" "libraries/*"] @@ -195,6 +197,7 @@ def configure(self): def generate(self): tc = CMakeToolchain(self) tc.variables["MORPHEUS_BUILD_DOCS"] = self.options.build_docs + tc.variables["MORPHEUS_MODULES_SUPPORT"] = self.options.build_with_modules tc.variables["MORPHEUS_LINK_WITH_MOLD"] = self.options.get_safe("link_with_mold", False) tc.generate() deps = CMakeDeps(self) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt new file mode 100644 index 00000000..33043bae --- /dev/null +++ b/modules/CMakeLists.txt @@ -0,0 +1,7 @@ +if (${MORPHEUS_MODULES_SUPPORT}) + + set(CMAKE_CXX_SCAN_FOR_MODULES ON) + + add_subdirectory(std) + +endif (${MORPHEUS_MODULES_SUPPORT}) diff --git a/modules/std/CMakeLists.txt b/modules/std/CMakeLists.txt new file mode 100644 index 00000000..2241c04b --- /dev/null +++ b/modules/std/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(std) diff --git a/modules/std/std.compat/CMakeLists.txt b/modules/std/std.compat/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/modules/std/std/CMakeLists.txt b/modules/std/std/CMakeLists.txt new file mode 100644 index 00000000..a2871eae --- /dev/null +++ b/modules/std/std/CMakeLists.txt @@ -0,0 +1,9 @@ +add_library(std) +target_sources(std + PUBLIC + FILE_SET CXX_MODULES TYPE CXX_MODULES + FILES + "std.ixx" +) + +target_compile_features(std PUBLIC cxx_std_23) diff --git a/modules/std/std/cstdint.ixx b/modules/std/std/cstdint.ixx new file mode 100644 index 00000000..3159414e --- /dev/null +++ b/modules/std/std/cstdint.ixx @@ -0,0 +1,38 @@ +export namespace std { + +using std::int8_t; +using std::int16_t; +using std::int32_t; +using std::int64_t; + +using std::uint8_t; +using std::uint16_t; +using std::uint32_t; +using std::uint64_t; + +using std::int_fast8_t; +using std::int_fast16_t; +using std::int_fast32_t; +using std::int_fast64_t; + +using std::uint_fast8_t; +using std::uint_fast16_t; +using std::uint_fast32_t; +using std::uint_fast64_t; + +using std::int_least8_t; +using std::int_least16_t; +using std::int_least32_t; +using std::int_least64_t; + +using std::uint_least8_t; +using std::uint_least16_t; +using std::uint_least32_t; +using std::uint_least64_t; +using std::intmax_t; +using std::uintmax_t; + +using std::intptr_t; +using std::uintptr_t; + +} diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx new file mode 100644 index 00000000..ade5d522 --- /dev/null +++ b/modules/std/std/std.ixx @@ -0,0 +1,11 @@ + +module; + +#include +#include +#include +#include + +export module std; + +#include "cstdint.ixx" From 3933607dd2d2a69a8b543c2dfaf4d57895c805e2 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sat, 13 Apr 2024 18:07:09 +0100 Subject: [PATCH 04/14] Syntax fix --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index b02b602e..89b61bf8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -66,7 +66,7 @@ class Morpheus(ConanFile): "fPIC": True, "tools": True, "build_docs": False, - "build_with_modules": False + "build_with_modules": False, "link_with_mold": True } exports_sources = ["CMakeLists.txt", "LICENSE", "version.txt", "cmake/*", "examples/*" "libraries/*"] From 3c03f7be5dd212093135f5f2784c13072c720c72 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 14 Apr 2024 13:37:42 +0100 Subject: [PATCH 05/14] Futher modularise the STL --- modules/std/std/concepts.mxx | 87 ++++++ modules/std/std/{cstdint.ixx => cstdint.mxx} | 0 modules/std/std/functional.mxx | 148 +++++++++ modules/std/std/source_location.mxx | 7 + modules/std/std/stacktrace.mxx | 27 ++ modules/std/std/std.ixx | 19 +- modules/std/std/string.mxx | 20 ++ modules/std/std/string_view.mxx | 17 + modules/std/std/thread.mxx | 37 +++ modules/std/std/type_traits.mxx | 312 +++++++++++++++++++ 10 files changed, 673 insertions(+), 1 deletion(-) create mode 100644 modules/std/std/concepts.mxx rename modules/std/std/{cstdint.ixx => cstdint.mxx} (100%) create mode 100644 modules/std/std/functional.mxx create mode 100644 modules/std/std/source_location.mxx create mode 100644 modules/std/std/stacktrace.mxx create mode 100644 modules/std/std/string.mxx create mode 100644 modules/std/std/string_view.mxx create mode 100644 modules/std/std/thread.mxx create mode 100644 modules/std/std/type_traits.mxx diff --git a/modules/std/std/concepts.mxx b/modules/std/std/concepts.mxx new file mode 100644 index 00000000..4146cf6a --- /dev/null +++ b/modules/std/std/concepts.mxx @@ -0,0 +1,87 @@ +export namespace std { + +// [concepts.lang], language-related concepts +// [concept.same], concept same_as +using std::same_as; + +// [concept.derived], concept derived_from +using std::derived_from; + +// [concept.convertible], concept convertible_to +using std::convertible_to; + +// [concept.commonref], concept common_reference_with +using std::common_reference_with; + +// [concept.common], concept common_with +using std::common_with; + +// [concepts.arithmetic], arithmetic concepts +using std::integral; +using std::signed_integral; +using std::unsigned_integral; +using std::floating_point; + +// [concept.assignable], concept assignable_from +using std::assignable_from; + +// [concept.swappable], concept swappable +//namespace ranges { +// inline namespace __cpo { +// using std::ranges::__cpo::swap; +// } +//} + +using std::swappable; +using std::swappable_with; + +// [concept.destructible], concept destructible +using std::destructible; + +// [concept.constructible], concept constructible_from +using std::constructible_from; + +// [concept.default.init], concept default_initializable +using std::default_initializable; + +// [concept.moveconstructible], concept move_constructible +using std::move_constructible; + +// [concept.copyconstructible], concept copy_constructible +using std::copy_constructible; + +// [concepts.compare], comparison concepts +// [concept.equalitycomparable], concept equality_comparable +using std::equality_comparable; +using std::equality_comparable_with; + +// [concept.totallyordered], concept totally_ordered +using std::totally_ordered; +using std::totally_ordered_with; + +// [concepts.object], object concepts +using std::movable; +using std::copyable; +using std::semiregular; +using std::regular; + +// [concepts.callable], callable concepts +// [concept.invocable], concept invocable +using std::invocable; + +// [concept.regularinvocable], concept regular_invocable +using std::regular_invocable; + +// [concept.predicate], concept predicate +using std::predicate; + +// [concept.relation], concept relation +using std::relation; + +// [concept.equiv], concept equivalence_relation +using std::equivalence_relation; + +// [concept.strictweakorder], concept strict_weak_order +using std::strict_weak_order; + +} diff --git a/modules/std/std/cstdint.ixx b/modules/std/std/cstdint.mxx similarity index 100% rename from modules/std/std/cstdint.ixx rename to modules/std/std/cstdint.mxx diff --git a/modules/std/std/functional.mxx b/modules/std/std/functional.mxx new file mode 100644 index 00000000..8d064e1e --- /dev/null +++ b/modules/std/std/functional.mxx @@ -0,0 +1,148 @@ +/// https://en.cppreference.com/w/cpp/header/functional +export namespace std +{ + +// [func.invoke], invoke +using std::invoke; + +#if (__cpp_lib_invoke_r >= 202106L) + using std::invoke_r; +#endif // #if (__cpp_lib_invoke_r >= 202106L) + +// [refwrap], reference_wrapper +using std::reference_wrapper; + +// [refwrap.common.ref], common_reference related specializations +using std::basic_common_reference; + +// [arithmetic.operations], arithmetic operations +using std::plus; +using std::minus; +using std::multiplies; +using std::divides; +using std::modulus; +using std::negate; + +// [comparisons], comparisons +using std::equal_to; +using std::not_equal_to; +using std::greater; +using std::less; +using std::greater_equal; +using std::less_equal; + +// [comparisons.three.way], class compare_three_way +using std::compare_three_way; + +// [logical.operations], logical operations +using std::logical_and; +using std::logical_or; +using std::logical_not; + +// [bitwise.operations], bitwise operations +using std::bit_and; +using std::bit_or; +using std::bit_xor; +using std::bit_not; + +// [func.identity], identity +using std::identity; + +// [func.not.fn], function template not_fn +using std::not_fn; + +// [func.bind.partial], function templates bind_front and bind_back +using std::bind_front; +using std::bind_back; + +// [func.bind], bind +using std::is_bind_expression; +using std::is_bind_expression_v; +using std::is_placeholder; +using std::is_placeholder_v; +using std::bind; + +// [func.bind.place] The number M of placeholders is implementation-defined +namespace placeholders +{ + +using std::placeholders::_1; +using std::placeholders::_2; +using std::placeholders::_3; +using std::placeholders::_4; +using std::placeholders::_5; +using std::placeholders::_6; +using std::placeholders::_7; +using std::placeholders::_8; +using std::placeholders::_9; +using std::placeholders::_10; + +} + +// [func.memfn], member function adaptors +using std::mem_fn; + +// [func.wrap], polymorphic function wrappers +// [func.wrap.badcall], class bad_function_call +using std::bad_function_call; + +// [func.wrap.func], class template function +using std::function; + +// [func.wrap.func.alg], function specialized algorithms +using std::swap; + +} // namespace std + + +/* +namespace std { + + // [func.wrap.func.nullptr], function null pointer comparison operator functions + template + bool operator==(const function&, nullptr_t) noexcept; + + // [func.wrap.move], move-only wrapper + template class move_only_function; // not defined + template + class move_only_function; // see below + + // [func.wrap.copy], copyable wrapper + template class copyable_function; // not defined + template + class copyable_function; // see below + + // [func.wrap.ref], non-owning wrapper + template class function_ref; // freestanding, not defined + template + class function_ref; // freestanding, see below + + // [func.search], searchers + template> + class default_searcher; // freestanding + + template::value_type>, + class BinaryPredicate = equal_to<>> + class boyer_moore_searcher; + + template::value_type>, + class BinaryPredicate = equal_to<>> + class boyer_moore_horspool_searcher; + + // [unord.hash], class template hash + template + struct hash; // freestanding + + namespace ranges { + // [range.cmp], concept-constrained comparisons + struct equal_to; // freestanding + struct not_equal_to; // freestanding + struct greater; // freestanding + struct less; // freestanding + struct greater_equal; // freestanding + struct less_equal; // freestanding + } +} +*/ diff --git a/modules/std/std/source_location.mxx b/modules/std/std/source_location.mxx new file mode 100644 index 00000000..0e27544b --- /dev/null +++ b/modules/std/std/source_location.mxx @@ -0,0 +1,7 @@ +export namespace std +{ + +// [char.traits], character traits +using std::source_location; + +} // namespace std diff --git a/modules/std/std/stacktrace.mxx b/modules/std/std/stacktrace.mxx new file mode 100644 index 00000000..3d8202d7 --- /dev/null +++ b/modules/std/std/stacktrace.mxx @@ -0,0 +1,27 @@ +export namespace std +{ + +// [stacktrace.entry], class stacktrace_­entry +using std::stacktrace_entry; + +// [stacktrace.basic], class template basic_­stacktrace +using std::basic_stacktrace; + +// basic_­stacktrace typedef-names +using std::stacktrace; + +// [stacktrace.basic.nonmem], non-member functions +using std::swap; + +using std::to_string; + +using std::operator<<; + +namespace pmr { + using std::pmr::stacktrace; +} + +// [stacktrace.basic.hash], hash support +using std::hash; + +} // namespace std diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index ade5d522..024ce41d 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -2,10 +2,27 @@ module; #include +#include #include +#include +#include #include #include +#include export module std; -#include "cstdint.ixx" +#include "cstdint.mxx" +#include "concepts.mxx" +#include "functional.mxx" +#include "string.mxx" +#include "source_location.mxx" +#include "stacktrace.mxx" +#include "string_view.mxx" +#include "type_traits.mxx" + +#pragma warning(push) +#pragma warning(disable : 5244) // '#include ' in the purview of module 'std' appears erroneous. + + +#pragma warning(pop) diff --git a/modules/std/std/string.mxx b/modules/std/std/string.mxx new file mode 100644 index 00000000..48bfcf7f --- /dev/null +++ b/modules/std/std/string.mxx @@ -0,0 +1,20 @@ +export namespace std +{ + +// [char.traits], character traits +using std::char_traits; + +// [basic.string], basic_string +using std::basic_string; + +// basic_string typedefs +using std::string; +using std::u16string; +using std::u32string; +using std::u8string; +using std::wstring; + +// [basic.string.hash], hash support +using std::hash; + +} // namespace std diff --git a/modules/std/std/string_view.mxx b/modules/std/std/string_view.mxx new file mode 100644 index 00000000..c8c1ba64 --- /dev/null +++ b/modules/std/std/string_view.mxx @@ -0,0 +1,17 @@ +export namespace std +{ + +// [string.view.template], class template basic_string_view +using std::basic_string_view; + +// basic_string_view typedefs +using std::string_view; +using std::u16string_view; +using std::u32string_view; +using std::u8string_view; +using std::wstring_view; + +// [string.view.hash], hash support +using std::hash; + +} // namespace std diff --git a/modules/std/std/thread.mxx b/modules/std/std/thread.mxx new file mode 100644 index 00000000..9624388f --- /dev/null +++ b/modules/std/std/thread.mxx @@ -0,0 +1,37 @@ +export namespace std +{ + +// [thread.thread.class], class thread +using std::thread; + +using std::swap; + +// [thread.jthread.class], class jthread +#if (__cpp_lib_jthread>=201911L) + using std::jthread; +#endif // #if (__cpp_lib_jthread>=201911L) + +// [thread.thread.this], namespace this_thread +namespace this_thread { + + using std::this_thread::get_id; + + using std::this_thread::yield; + using std::this_thread::sleep_until; + using std::this_thread::sleep_for; + +} + +// [thread.thread.id] +using std::operator==; +using std::operator<=>; + +using std::operator<<; + +#if (__cpp_lib_formatters < 202302L) + using std::formatter; +#endif // #if (__cpp_lib_formatters < 202302L) + +using std::hash; + +} // namespace std diff --git a/modules/std/std/type_traits.mxx b/modules/std/std/type_traits.mxx new file mode 100644 index 00000000..35ca4f2d --- /dev/null +++ b/modules/std/std/type_traits.mxx @@ -0,0 +1,312 @@ +export namespace std +{ + +// [meta.help], helper class +using std::integral_constant; + +using std::bool_constant; +using std::bool_constant; +using std::false_type; + +// [meta.unary.cat], primary type categories +using std::is_void; +using std::is_null_pointer; +using std::is_integral; +using std::is_floating_point; +using std::is_array; +using std::is_pointer; +using std::is_lvalue_reference; +using std::is_rvalue_reference; +using std::is_member_object_pointer; +using std::is_member_function_pointer; +using std::is_enum; +using std::is_union; +using std::is_class; +using std::is_function; + +// [meta.unary.comp], composite type categories +using std::is_reference; +using std::is_arithmetic; +using std::is_fundamental; +using std::is_object; +using std::is_scalar; +using std::is_compound; +using std::is_member_pointer; + +// [meta.unary.prop], type properties +using std::is_const; +using std::is_volatile; +using std::is_trivial; +using std::is_trivially_copyable; +using std::is_standard_layout; +using std::is_empty; +using std::is_polymorphic; +using std::is_abstract; +using std::is_final; +using std::is_aggregate; + +using std::is_signed; +using std::is_unsigned; +using std::is_bounded_array; +using std::is_unbounded_array; +using std::is_scoped_enum; + +using std::is_constructible; +using std::is_default_constructible; +using std::is_copy_constructible; +using std::is_move_constructible; + +using std::is_assignable; +using std::is_copy_assignable; +using std::is_move_assignable; + +using std::is_swappable_with; +using std::is_swappable; + +using std::is_destructible; + +using std::is_trivially_constructible; +using std::is_trivially_default_constructible; +using std::is_trivially_copy_constructible; +using std::is_trivially_move_constructible; + +using std::is_trivially_assignable; +using std::is_trivially_copy_assignable; +using std::is_trivially_move_assignable; +using std::is_trivially_destructible; + +using std::is_nothrow_constructible; +using std::is_nothrow_default_constructible; +using std::is_nothrow_copy_constructible; +using std::is_nothrow_move_constructible; + +using std::is_nothrow_assignable; +using std::is_nothrow_copy_assignable; +using std::is_nothrow_move_assignable; + +using std::is_nothrow_swappable_with; +using std::is_nothrow_swappable; + +using std::is_nothrow_destructible; + +#if (__cpp_lib_is_implicit_lifetime>=202302L) + using std::is_implicit_lifetime; +#endif // #if (__cpp_lib_is_implicit_lifetime>=202302L) + +using std::has_virtual_destructor; + +using std::has_unique_object_representations; + +#if (__cpp_lib_reference_from_temporary>=202202L) + using std::reference_constructs_from_temporary; + using std::reference_converts_from_temporary; +#endif // #if (__cpp_lib_reference_from_temporary>=202202L) + +// [meta.unary.prop.query], type property queries +using std::alignment_of; +using std::rank; +using std::extent; + +// [meta.rel], type relations +using std::is_same; +using std::is_base_of; +using std::is_convertible; +using std::is_nothrow_convertible; +using std::is_layout_compatible; +using std::is_pointer_interconvertible_base_of; + +using std::is_invocable; +using std::is_invocable_r; + +using std::is_nothrow_invocable; +using std::is_nothrow_invocable_r; + +// [meta.trans.cv], const-volatile modifications +using std::remove_const; +using std::remove_volatile; +using std::remove_cv; +using std::add_const; +using std::add_volatile; +using std::add_cv; + +using std::remove_const_t; +using std::remove_volatile_t; +using std::remove_cv_t; +using std::add_const_t; +using std::add_volatile_t; +using std::add_cv_t; + +// [meta.trans.ref], reference modifications +using std::remove_reference; +using std::add_lvalue_reference; +using std::add_rvalue_reference; + +using std::remove_reference_t; +using std::add_lvalue_reference_t; +using std::add_rvalue_reference_t; + +// [meta.trans.sign], sign modifications +using std::make_signed; +using std::make_unsigned; + +using std::make_signed_t; +using std::make_unsigned_t; + +// [meta.trans.arr], array modifications +using std::remove_extent; +using std::remove_all_extents; + +using std::remove_extent_t; +using std::remove_all_extents_t; + +// [meta.trans.ptr], pointer modifications +using std::remove_pointer; +using std::add_pointer; + +using std::remove_pointer_t; +using std::add_pointer_t; + +// [meta.trans.other], other transformations +using std::type_identity; +using std::remove_cvref; +using std::decay; +using std::enable_if; +using std::conditional; +using std::common_type; +using std::basic_common_reference; +using std::common_reference; +using std::underlying_type; +using std::invoke_result; +using std::unwrap_reference; +using std::unwrap_ref_decay; + +using std::type_identity_t; +using std::remove_cvref_t; +using std::decay_t; +using std::enable_if_t; +using std::conditional_t; +using std::common_type_t; +using std::common_reference_t; +using std::underlying_type_t; +using std::invoke_result_t; +using std::unwrap_reference_t; +using std::unwrap_ref_decay_t; +using std::void_t; + +// [meta.logical], logical operator traits +using std::conjunction; +using std::disjunction; +using std::negation; + +// [meta.unary.cat], primary type categories +using std::is_void_v; +using std::is_null_pointer_v; +using std::is_integral_v; +using std::is_floating_point_v; +using std::is_array_v; +using std::is_pointer_v; +using std::is_lvalue_reference_v; +using std::is_rvalue_reference_v; +using std::is_member_object_pointer_v; +using std::is_member_function_pointer_v; +using std::is_enum_v; +using std::is_union_v; +using std::is_class_v; +using std::is_function_v; + +// [meta.unary.comp], composite type categories +using std::is_reference_v; +using std::is_arithmetic_v; +using std::is_fundamental_v; +using std::is_object_v; +using std::is_scalar_v; +using std::is_compound_v; +using std::is_member_pointer_v; + +// [meta.unary.prop], type properties +using std::is_const_v; +using std::is_volatile_v; +using std::is_trivial_v; +using std::is_trivially_copyable_v; +using std::is_standard_layout_v; +using std::is_empty_v; +using std::is_polymorphic_v; +using std::is_abstract_v; +using std::is_aggregate_v; +using std::is_signed_v; +using std::is_unsigned_v; +using std::is_bounded_array; +using std::is_unbounded_array_v; +using std::is_scoped_enum_v; +using std::is_constructible_v; +using std::is_default_constructible_v; +using std::is_copy_constructible_v; +using std::is_move_constructible_v; +using std::is_assignable_v; +using std::is_copy_assignable_v; +using std::is_move_assignable_v; +using std::is_swappable_with_v; +using std::is_swappable_v; +using std::is_destructible_v; +using std::is_trivially_constructible_v; +using std::is_trivially_default_constructible_v; +using std::is_trivially_copy_constructible_v; +using std::is_trivially_move_constructible_v; +using std::is_trivially_assignable_v; +using std::is_trivially_copy_assignable_v; +using std::is_trivially_move_assignable_v; +using std::is_trivially_destructible_v; +using std::is_nothrow_constructible_v; +using std::is_nothrow_default_constructible_v; +using std::is_nothrow_copy_constructible_v; +using std::is_nothrow_move_constructible_v; +using std::is_nothrow_assignable_v; +using std::is_nothrow_copy_assignable_v; +using std::is_nothrow_move_assignable_v; +using std::is_nothrow_swappable_with_v; +using std::is_nothrow_swappable_v; +using std::is_nothrow_destructible_v; +#if (__cpp_lib_is_implicit_lifetime>=202302L) + using std::is_implicit_lifetime_v; +#endif // #if (__cpp_lib_is_implicit_lifetime>=202302L) +using std::has_virtual_destructor_v; +using std::has_unique_object_representations_v; +#if (__cpp_lib_reference_from_temporary>=202202L) + using std::reference_constructs_from_temporary_v; + using std::reference_converts_from_temporary_v; +#endif // #if (__cpp_lib_reference_from_temporary>=202202L) + +// [meta.unary.prop.query], type property queries +using std::alignment_of_v; +using std::rank_v; +using std::extent_v; + +// [meta.rel], type relations +using std::is_same_v; +using std::is_base_of_v; +using std::is_convertible_v; +using std::is_nothrow_convertible_v; +using std::is_layout_compatible_v; +using std::is_pointer_interconvertible_base_of_v; +using std::is_invocable_v; +using std::is_invocable_r_v; +using std::is_nothrow_invocable_v; +using std::is_nothrow_invocable_r_v; + +// [meta.logical], logical operator traits +using std::conjunction_v; +using std::disjunction_v; +using std::negation_v; + +// [meta.member], member relationships +using std::is_pointer_interconvertible_with_class; +using std::is_corresponding_member; + +using std::is_const_v; +using std::is_const_v; + +// [meta.const.eval], constant evaluation context +//using std::is_constant_evaluated; +//using std::is_within_lifetime; + +} // namespace std From d664c9090f8c0dce92125085c4f5946ce7a76267 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 14 Apr 2024 19:49:10 +0100 Subject: [PATCH 06/14] Futher STL modularisation support --- modules/std/std/algorithm.hpp | 1804 +++++++++++++++++ modules/std/std/any.hpp | 16 + modules/std/std/array.hpp | 22 + .../std/std/{concepts.mxx => concepts.hpp} | 1 + modules/std/std/{cstdint.mxx => cstdint.hpp} | 8 +- .../std/{functional.mxx => functional.hpp} | 0 ...ource_location.mxx => source_location.hpp} | 0 .../std/{stacktrace.mxx => stacktrace.hpp} | 0 modules/std/std/std.ixx | 2 + modules/std/std/{string.mxx => string.hpp} | 1 + .../std/{string_view.mxx => string_view.hpp} | 1 + modules/std/std/{thread.mxx => thread.hpp} | 1 + .../std/{type_traits.mxx => type_traits.hpp} | 1 + modules/std/std/vector.hpp | 31 + 14 files changed, 1885 insertions(+), 3 deletions(-) create mode 100644 modules/std/std/algorithm.hpp create mode 100644 modules/std/std/any.hpp create mode 100644 modules/std/std/array.hpp rename modules/std/std/{concepts.mxx => concepts.hpp} (96%) rename modules/std/std/{cstdint.mxx => cstdint.hpp} (90%) rename modules/std/std/{functional.mxx => functional.hpp} (100%) rename modules/std/std/{source_location.mxx => source_location.hpp} (100%) rename modules/std/std/{stacktrace.mxx => stacktrace.hpp} (100%) rename modules/std/std/{string.mxx => string.hpp} (83%) rename modules/std/std/{string_view.mxx => string_view.hpp} (81%) rename modules/std/std/{thread.mxx => thread.hpp} (91%) rename modules/std/std/{type_traits.mxx => type_traits.hpp} (99%) create mode 100644 modules/std/std/vector.hpp diff --git a/modules/std/std/algorithm.hpp b/modules/std/std/algorithm.hpp new file mode 100644 index 00000000..70810240 --- /dev/null +++ b/modules/std/std/algorithm.hpp @@ -0,0 +1,1804 @@ +/// \algorithm.hpp Modularisation for https://eel.is/c++draft/algorithm.syn +export namespace std +{ + +namespace ranges +{ + +// [algorithms.results], algorithm result types +using std::ranges::in_fun_result; +using std::ranges::in_in_result; +using std::ranges::in_out_result; +using std::ranges::in_in_out_result; +using std::ranges::in_out_out_result; +using std::ranges::min_max_result; +using std::ranges::in_found_result; +using std::ranges::in_value_result; +using std::ranges::out_value_result; + +} + +// [alg.nonmodifying], non-modifying sequence operations +// [alg.all.of], all of +using std::all_of; + +namespace ranges +{ + +using std::ranges::all_of; + +} + +// [alg.any.of], any of +using std::any_of; + +namespace ranges +{ + +using std::ranges::any_of; + +} + +// [alg.none.of], none of +using std::none_of; + +namespace ranges +{ + +using std::ranges::none_of; + +} + +#if (__cpp_lib_ranges_contains >= 202207L) + namespace ranges + { + + using std::ranges::contains; + using std::ranges::contains_subrange; + + } +#endif // #if (__cpp_lib_ranges_contains >= 202207L) + +// [alg.foreach], for each +using std::for_each; +using std::for_each_n; + +namespace ranges +{ + +using std::ranges::for_each; +using std::ranges::for_each_result; +using std::ranges::for_each_n; +using std::ranges::for_each_n_result; + +} + +// [alg.find], find +using std::find; +using std::find_if; +using std::find_if_not; + +namespace ranges +{ + +using std::ranges::find; +using std::ranges::find_if; +using std::ranges::find_if_not; + +} // namespace ranges + +// [alg.find.last], find last +namespace ranges +{ + +using std::ranges::find_last; +using std::ranges::find_last_if; +using std::ranges::find_last_if_not; + +} // namespace ranges + +// [alg.find.end], find end +using std::find_end; + +namespace ranges +{ + +using std::ranges::find_end; + +} + +// [alg.find.first.of], find first +using std::find_first_of; + +namespace ranges +{ + +using std::ranges::find_first_of; + +} + +// [alg.adjacent.find], adjacent find +using std::adjacent_find; + +namespace ranges +{ + +using std::ranges::adjacent_find; + +} + +// [alg.count], count +using std::count; +using std::count_if; + +namespace ranges +{ + +using std::ranges::count; +using std::ranges::count_if; + +} + +// [alg.mismatch], mismatch +using std::mismatch; + +namespace ranges +{ + +using std::ranges::mismatch; +using std::ranges::mismatch_result; + +} // namespace ranges + +// [alg.equal], equal +using std::equal; + +namespace ranges +{ + +using std::ranges::equal; + +} + +// [alg.is.permutation], is permutation +using std::is_permutation; + +namespace ranges +{ + +using std::ranges::is_permutation; + +} + +// [alg.search], search +using std::search; +using std::search_n; + +namespace ranges +{ + +using std::ranges::search; +using std::ranges::search_n; + +} + +namespace ranges +{ + +#if (__cpp_lib_ranges_starts_ends_with >= 202106L) + + // [alg.starts.with], starts with + using std::ranges::starts_with; + + // [alg.ends.with], ends with + using std::ranges::ends_with; + +#endif // #if (__cpp_lib_ranges_starts_ends_with >= 202106L) + +#if (__cpp_lib_ranges_fold >= 202207L) + + // [alg.fold], fold + using std::ranges::fold_left; + using std::ranges::fold_left_first; + using std::ranges::fold_right; + using std::ranges::fold_right_last; + using std::ranges::fold_left_first_with_iter_result; + using std::ranges::fold_left_first_with_iter; + +#endif // #if (__cpp_lib_ranges_starts_ends_with >= 202207L) + +} // namespace ranges + +// [alg.modifying.operations], mutating sequence operations +// [alg.copy], copy +using std::copy; +using std::copy_n; +using std::copy_if; +using std::copy_backward; + +namespace ranges +{ + +using std::ranges::copy; +using std::ranges::copy_result; +using std::ranges::copy_n; +using std::ranges::copy_n_result; +using std::ranges::copy_if; +using std::ranges::copy_if_result; +using std::ranges::copy_backward; +using std::ranges::copy_backward_result; + +} + +// [alg.move], move +using std::move; +using std::move_backward; + +namespace ranges +{ + +using std::ranges::move; +using std::ranges::move_result; +using std::ranges::move_backward; +using std::ranges::move_backward_result; + +} // namespace ranges + +// [alg.swap], swap +using std::swap_ranges; + +namespace ranges +{ + +using std::ranges::swap_ranges; +using std::ranges::swap_ranges_result; + +} // namespace ranges + +using std::iter_swap; + +// [alg.transform], transform +using std::transform; + +namespace ranges +{ + +using std::ranges::transform; +using std::ranges::unary_transform_result; +using std::ranges::binary_transform_result; + +} // namespace ranges + +} // namespace std + + +/* +namespace std { + + + // [alg.replace], replace + template + constexpr void replace(ForwardIterator first, ForwardIterator last, + const T& old_value, const T& new_value); + template + void replace(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + const T& old_value, const T& new_value); + template + constexpr void replace_if(ForwardIterator first, ForwardIterator last, + Predicate pred, const T& new_value); + template + void replace_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Predicate pred, const T& new_value); + + namespace ranges { + template S, class T1, class T2, class Proj = identity> + requires indirectly_writable && + indirect_binary_predicate, const T1*> + constexpr I + replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); + template + requires indirectly_writable, const T2&> && + indirect_binary_predicate, Proj>, const T1*> + constexpr borrowed_iterator_t + replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); + template S, class T, class Proj = identity, + indirect_unary_predicate> Pred> + requires indirectly_writable + constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); + template, Proj>> Pred> + requires indirectly_writable, const T&> + constexpr borrowed_iterator_t + replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); + } + + template + constexpr OutputIterator replace_copy(InputIterator first, InputIterator last, + OutputIterator result, + const T& old_value, const T& new_value); + template + ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, + const T& old_value, const T& new_value); + template + constexpr OutputIterator replace_copy_if(InputIterator first, InputIterator last, + OutputIterator result, + Predicate pred, const T& new_value); + template + ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, + Predicate pred, const T& new_value); + + namespace ranges { + template + using replace_copy_result = in_out_result; + + template S, class T1, class T2, + output_iterator O, class Proj = identity> + requires indirectly_copyable && + indirect_binary_predicate, const T1*> + constexpr replace_copy_result + replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, + Proj proj = {}); + template O, + class Proj = identity> + requires indirectly_copyable, O> && + indirect_binary_predicate, Proj>, const T1*> + constexpr replace_copy_result, O> + replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, + Proj proj = {}); + + template + using replace_copy_if_result = in_out_result; + + template S, class T, output_iterator O, + class Proj = identity, indirect_unary_predicate> Pred> + requires indirectly_copyable + constexpr replace_copy_if_result + replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, + Proj proj = {}); + template O, class Proj = identity, + indirect_unary_predicate, Proj>> Pred> + requires indirectly_copyable, O> + constexpr replace_copy_if_result, O> + replace_copy_if(R&& r, O result, Pred pred, const T& new_value, + Proj proj = {}); + } + + // [alg.fill], fill + template + constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); + template + void fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, const T& value); + template + constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value); // freestanding + template + ForwardIterator fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, Size n, const T& value); + + namespace ranges { + template O, sentinel_for S> + constexpr O fill(O first, S last, const T& value); + template R> + constexpr borrowed_iterator_t fill(R&& r, const T& value); + template O> + constexpr O fill_n(O first, iter_difference_t n, const T& value); + } + + // [alg.generate], generate + template + constexpr void generate(ForwardIterator first, ForwardIterator last, + Generator gen); + template + void generate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Generator gen); + template + constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen); + template + ForwardIterator generate_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, Size n, Generator gen); + + namespace ranges { + template S, copy_constructible F> + requires invocable && indirectly_writable> + constexpr O generate(O first, S last, F gen); + template + requires invocable && output_range> + constexpr borrowed_iterator_t generate(R&& r, F gen); + template + requires invocable && indirectly_writable> + constexpr O generate_n(O first, iter_difference_t n, F gen); + } + + // [alg.remove], remove + template + constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last, + const T& value); + template + ForwardIterator remove(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + const T& value); + template + constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last, + Predicate pred); + template + ForwardIterator remove_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Predicate pred); + + namespace ranges { + template S, class T, class Proj = identity> + requires indirect_binary_predicate, const T*> + constexpr subrange remove(I first, S last, const T& value, Proj proj = {}); + template + requires permutable> && + indirect_binary_predicate, Proj>, const T*> + constexpr borrowed_subrange_t + remove(R&& r, const T& value, Proj proj = {}); + template S, class Proj = identity, + indirect_unary_predicate> Pred> + constexpr subrange remove_if(I first, S last, Pred pred, Proj proj = {}); + template, Proj>> Pred> + requires permutable> + constexpr borrowed_subrange_t + remove_if(R&& r, Pred pred, Proj proj = {}); + } + + template + constexpr OutputIterator + remove_copy(InputIterator first, InputIterator last, + OutputIterator result, const T& value); + template + ForwardIterator2 + remove_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, const T& value); + template + constexpr OutputIterator + remove_copy_if(InputIterator first, InputIterator last, + OutputIterator result, Predicate pred); + template + ForwardIterator2 + remove_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, Predicate pred); + + namespace ranges { + template + using remove_copy_result = in_out_result; + + template S, weakly_incrementable O, class T, + class Proj = identity> + requires indirectly_copyable && + indirect_binary_predicate, const T*> + constexpr remove_copy_result + remove_copy(I first, S last, O result, const T& value, Proj proj = {}); + template + requires indirectly_copyable, O> && + indirect_binary_predicate, Proj>, const T*> + constexpr remove_copy_result, O> + remove_copy(R&& r, O result, const T& value, Proj proj = {}); + + template + using remove_copy_if_result = in_out_result; + + template S, weakly_incrementable O, + class Proj = identity, indirect_unary_predicate> Pred> + requires indirectly_copyable + constexpr remove_copy_if_result + remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); + template, Proj>> Pred> + requires indirectly_copyable, O> + constexpr remove_copy_if_result, O> + remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); + } + + // [alg.unique], unique + template + constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last); + template + constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last, + BinaryPredicate pred); + template + ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + BinaryPredicate pred); + + namespace ranges { + template S, class Proj = identity, + indirect_equivalence_relation> C = ranges::equal_to> + constexpr subrange unique(I first, S last, C comp = {}, Proj proj = {}); + template, Proj>> C = ranges::equal_to> + requires permutable> + constexpr borrowed_subrange_t + unique(R&& r, C comp = {}, Proj proj = {}); + } + + template + constexpr OutputIterator + unique_copy(InputIterator first, InputIterator last, + OutputIterator result); + template + constexpr OutputIterator + unique_copy(InputIterator first, InputIterator last, + OutputIterator result, BinaryPredicate pred); + template + ForwardIterator2 + unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result); + template + ForwardIterator2 + unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 last, + ForwardIterator2 result, BinaryPredicate pred); + + namespace ranges { + template + using unique_copy_result = in_out_result; + + template S, weakly_incrementable O, class Proj = identity, + indirect_equivalence_relation> C = ranges::equal_to> + requires indirectly_copyable && + (forward_iterator || + (input_iterator && same_as, iter_value_t>) || + indirectly_copyable_storable) + constexpr unique_copy_result + unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); + template, Proj>> C = ranges::equal_to> + requires indirectly_copyable, O> && + (forward_iterator> || + (input_iterator && same_as, iter_value_t>) || + indirectly_copyable_storable, O>) + constexpr unique_copy_result, O> + unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); + } + + // [alg.reverse], reverse + template + constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last); + template + void reverse(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + BidirectionalIterator first, BidirectionalIterator last); + + namespace ranges { + template S> + requires permutable + constexpr I reverse(I first, S last); + template + requires permutable> + constexpr borrowed_iterator_t reverse(R&& r); + } + + template + constexpr OutputIterator + reverse_copy(BidirectionalIterator first, BidirectionalIterator last, + OutputIterator result); + template + ForwardIterator + reverse_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + BidirectionalIterator first, BidirectionalIterator last, + ForwardIterator result); + + namespace ranges { + template + using reverse_copy_result = in_out_result; + + template S, weakly_incrementable O> + requires indirectly_copyable + constexpr reverse_copy_result + reverse_copy(I first, S last, O result); + template + requires indirectly_copyable, O> + constexpr reverse_copy_result, O> + reverse_copy(R&& r, O result); + } + + // [alg.rotate], rotate + template + constexpr ForwardIterator rotate(ForwardIterator first, + ForwardIterator middle, + ForwardIterator last); + template + ForwardIterator rotate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, + ForwardIterator middle, + ForwardIterator last); + + namespace ranges { + template S> + constexpr subrange rotate(I first, I middle, S last); + template + requires permutable> + constexpr borrowed_subrange_t rotate(R&& r, iterator_t middle); + } + + template + constexpr OutputIterator + rotate_copy(ForwardIterator first, ForwardIterator middle, + ForwardIterator last, OutputIterator result); + template + ForwardIterator2 + rotate_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first, ForwardIterator1 middle, + ForwardIterator1 last, ForwardIterator2 result); + + namespace ranges { + template + using rotate_copy_result = in_out_result; + + template S, weakly_incrementable O> + requires indirectly_copyable + constexpr rotate_copy_result + rotate_copy(I first, I middle, S last, O result); + template + requires indirectly_copyable, O> + constexpr rotate_copy_result, O> + rotate_copy(R&& r, iterator_t middle, O result); + } + + // [alg.random.sample], sample + template + SampleIterator sample(PopulationIterator first, PopulationIterator last, + SampleIterator out, Distance n, + UniformRandomBitGenerator&& g); + + namespace ranges { + template S, + weakly_incrementable O, class Gen> + requires (forward_iterator || random_access_iterator) && + indirectly_copyable && + uniform_random_bit_generator> + O sample(I first, S last, O out, iter_difference_t n, Gen&& g); + template + requires (forward_range || random_access_iterator) && + indirectly_copyable, O> && + uniform_random_bit_generator> + O sample(R&& r, O out, range_difference_t n, Gen&& g); + } + + // [alg.random.shuffle], shuffle + template + void shuffle(RandomAccessIterator first, + RandomAccessIterator last, + UniformRandomBitGenerator&& g); + + namespace ranges { + template S, class Gen> + requires permutable && + uniform_random_bit_generator> + I shuffle(I first, S last, Gen&& g); + template + requires permutable> && + uniform_random_bit_generator> + borrowed_iterator_t shuffle(R&& r, Gen&& g); + } + + // [alg.shift], shift + template + constexpr ForwardIterator + shift_left(ForwardIterator first, ForwardIterator last, + typename iterator_traits::difference_type n); + template + ForwardIterator + shift_left(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + typename iterator_traits::difference_type n); + + namespace ranges { + template S> + constexpr subrange shift_left(I first, S last, iter_difference_t n); + template + requires permutable> + constexpr borrowed_subrange_t shift_left(R&& r, range_difference_t n); + } + + template + constexpr ForwardIterator + shift_right(ForwardIterator first, ForwardIterator last, + typename iterator_traits::difference_type n); + template + ForwardIterator + shift_right(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + typename iterator_traits::difference_type n); + + namespace ranges { + template S> + constexpr subrange shift_right(I first, S last, iter_difference_t n); + template + requires permutable> + constexpr borrowed_subrange_t shift_right(R&& r, range_difference_t n); + } + + // [alg.sorting], sorting and related operations + // [alg.sort], sorting + template + constexpr void sort(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void sort(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + template + void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last); + template + void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + sort(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + sort(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + template + void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last); + template + void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + stable_sort(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, + RandomAccessIterator last); + template + constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, + RandomAccessIterator last, Compare comp); + template + void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator middle, + RandomAccessIterator last); + template + void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator middle, + RandomAccessIterator last, Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + partial_sort(R&& r, iterator_t middle, Comp comp = {}, + Proj proj = {}); + } + + template + constexpr RandomAccessIterator + partial_sort_copy(InputIterator first, InputIterator last, + RandomAccessIterator result_first, + RandomAccessIterator result_last); + template + constexpr RandomAccessIterator + partial_sort_copy(InputIterator first, InputIterator last, + RandomAccessIterator result_first, + RandomAccessIterator result_last, + Compare comp); + template + RandomAccessIterator + partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + RandomAccessIterator result_first, + RandomAccessIterator result_last); + template + RandomAccessIterator + partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + RandomAccessIterator result_first, + RandomAccessIterator result_last, + Compare comp); + + namespace ranges { + template + using partial_sort_copy_result = in_out_result; + + template S1, + random_access_iterator I2, sentinel_for S2, + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> + requires indirectly_copyable && sortable && + indirect_strict_weak_order, projected> + constexpr partial_sort_copy_result + partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + template + requires indirectly_copyable, iterator_t> && + sortable, Comp, Proj2> && + indirect_strict_weak_order, Proj1>, + projected, Proj2>> + constexpr partial_sort_copy_result, borrowed_iterator_t> + partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr bool is_sorted(ForwardIterator first, ForwardIterator last); + template + constexpr bool is_sorted(ForwardIterator first, ForwardIterator last, + Compare comp); + template + bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last); + template + constexpr ForwardIterator + is_sorted_until(ForwardIterator first, ForwardIterator last, + Compare comp); + template + ForwardIterator + is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + ForwardIterator + is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t + is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); + } + + // [alg.nth.element], Nth element + template + constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, + RandomAccessIterator last); + template + constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, + RandomAccessIterator last, Compare comp); + template + void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator nth, + RandomAccessIterator last); + template + void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator nth, + RandomAccessIterator last, Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); + } + + // [alg.binary.search], binary search + template + constexpr ForwardIterator + lower_bound(ForwardIterator first, ForwardIterator last, + const T& value); + template + constexpr ForwardIterator + lower_bound(ForwardIterator first, ForwardIterator last, + const T& value, Compare comp); + + namespace ranges { + template S, class T, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); + template, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t + lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); + } + + template + constexpr ForwardIterator + upper_bound(ForwardIterator first, ForwardIterator last, + const T& value); + template + constexpr ForwardIterator + upper_bound(ForwardIterator first, ForwardIterator last, + const T& value, Compare comp); + + namespace ranges { + template S, class T, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = + ranges::less> + constexpr borrowed_iterator_t + upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); + } + + template + constexpr pair + equal_range(ForwardIterator first, ForwardIterator last, + const T& value); + template + constexpr pair + equal_range(ForwardIterator first, ForwardIterator last, + const T& value, Compare comp); + + namespace ranges { + template S, class T, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr subrange + equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = + ranges::less> + constexpr borrowed_subrange_t + equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); + } + + template + constexpr bool + binary_search(ForwardIterator first, ForwardIterator last, + const T& value); + template + constexpr bool + binary_search(ForwardIterator first, ForwardIterator last, + const T& value, Compare comp); + + namespace ranges { + template S, class T, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, + Proj proj = {}); + template, Proj>> Comp = + ranges::less> + constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, + Proj proj = {}); + } + + // [alg.partitions], partitions + template + constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred); + template + bool is_partitioned(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, Predicate pred); + + namespace ranges { + template S, class Proj = identity, + indirect_unary_predicate> Pred> + constexpr bool is_partitioned(I first, S last, Pred pred, Proj proj = {}); + template, Proj>> Pred> + constexpr bool is_partitioned(R&& r, Pred pred, Proj proj = {}); + } + + template + constexpr ForwardIterator partition(ForwardIterator first, + ForwardIterator last, + Predicate pred); + template + ForwardIterator partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, + ForwardIterator last, + Predicate pred); + + namespace ranges { + template S, class Proj = identity, + indirect_unary_predicate> Pred> + constexpr subrange + partition(I first, S last, Pred pred, Proj proj = {}); + template, Proj>> Pred> + requires permutable> + constexpr borrowed_subrange_t + partition(R&& r, Pred pred, Proj proj = {}); + } + + template + constexpr BidirectionalIterator stable_partition(BidirectionalIterator first, + BidirectionalIterator last, + Predicate pred); + template + BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + BidirectionalIterator first, + BidirectionalIterator last, + Predicate pred); + + namespace ranges { + template S, class Proj = identity, + indirect_unary_predicate> Pred> + requires permutable + constexpr subrange stable_partition(I first, S last, Pred pred, Proj proj = {}); + template, Proj>> Pred> + requires permutable> + constexpr borrowed_subrange_t stable_partition(R&& r, Pred pred, Proj proj = {}); + } + + template + constexpr pair + partition_copy(InputIterator first, InputIterator last, + OutputIterator1 out_true, OutputIterator2 out_false, + Predicate pred); + template + pair + partition_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + ForwardIterator1 out_true, ForwardIterator2 out_false, + Predicate pred); + + namespace ranges { + template + using partition_copy_result = in_out_out_result; + + template S, + weakly_incrementable O1, weakly_incrementable O2, + class Proj = identity, indirect_unary_predicate> Pred> + requires indirectly_copyable && indirectly_copyable + constexpr partition_copy_result + partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, + Proj proj = {}); + template, Proj>> Pred> + requires indirectly_copyable, O1> && + indirectly_copyable, O2> + constexpr partition_copy_result, O1, O2> + partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); + } + + template + constexpr ForwardIterator + partition_point(ForwardIterator first, ForwardIterator last, + Predicate pred); + + namespace ranges { + template S, class Proj = identity, + indirect_unary_predicate> Pred> + constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); + template, Proj>> Pred> + constexpr borrowed_iterator_t + partition_point(R&& r, Pred pred, Proj proj = {}); + } + + // [alg.merge], merge + template + constexpr OutputIterator + merge(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); + template + constexpr OutputIterator + merge(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result, Compare comp); + template + ForwardIterator + merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result); + template + ForwardIterator + merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result, Compare comp); + + namespace ranges { + template + using merge_result = in_in_out_result; + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, + class Proj2 = identity> + requires mergeable + constexpr merge_result + merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr merge_result, borrowed_iterator_t, O> + merge(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr void inplace_merge(BidirectionalIterator first, + BidirectionalIterator middle, + BidirectionalIterator last); + template + constexpr void inplace_merge(BidirectionalIterator first, + BidirectionalIterator middle, + BidirectionalIterator last, Compare comp); + template + void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + BidirectionalIterator first, + BidirectionalIterator middle, + BidirectionalIterator last); + template + void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + BidirectionalIterator first, + BidirectionalIterator middle, + BidirectionalIterator last, Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + inplace_merge(R&& r, iterator_t middle, Comp comp = {}, + Proj proj = {}); + } + + // [alg.set.operations], set operations + template + constexpr bool includes(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); + template + constexpr bool includes(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp); + template + bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); + template + bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + Compare comp); + + namespace ranges { + template S1, input_iterator I2, sentinel_for S2, + class Proj1 = identity, class Proj2 = identity, + indirect_strict_weak_order, projected> Comp = + ranges::less> + constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + template, Proj1>, + projected, Proj2>> Comp = ranges::less> + constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr OutputIterator + set_union(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); + template + constexpr OutputIterator + set_union(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result, Compare comp); + template + ForwardIterator + set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result); + template + ForwardIterator + set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result, Compare comp); + + namespace ranges { + template + using set_union_result = in_in_out_result; + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_union_result + set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_union_result, borrowed_iterator_t, O> + set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr OutputIterator + set_intersection(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); + template + constexpr OutputIterator + set_intersection(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result, Compare comp); + template + ForwardIterator + set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result); + template + ForwardIterator + set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result, Compare comp); + + namespace ranges { + template + using set_intersection_result = in_in_out_result; + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_intersection_result + set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_intersection_result, borrowed_iterator_t, O> + set_intersection(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr OutputIterator + set_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); + template + constexpr OutputIterator + set_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result, Compare comp); + template + ForwardIterator + set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result); + template + ForwardIterator + set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result, Compare comp); + + namespace ranges { + template + using set_difference_result = in_out_result; + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_difference_result + set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_difference_result, O> + set_difference(R1&& r1, R2&& r2, O result, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + template + constexpr OutputIterator + set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result); + template + constexpr OutputIterator + set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + OutputIterator result, Compare comp); + template + ForwardIterator + set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result); + template + ForwardIterator + set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + ForwardIterator result, Compare comp); + + namespace ranges { + template + using set_symmetric_difference_result = in_in_out_result; + + template S1, input_iterator I2, sentinel_for S2, + weakly_incrementable O, class Comp = ranges::less, + class Proj1 = identity, class Proj2 = identity> + requires mergeable + constexpr set_symmetric_difference_result + set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, + Comp comp = {}, Proj1 proj1 = {}, + Proj2 proj2 = {}); + template + requires mergeable, iterator_t, O, Comp, Proj1, Proj2> + constexpr set_symmetric_difference_result, + borrowed_iterator_t, O> + set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + // [alg.heap.operations], heap operations + template + constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + push_heap(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + push_heap(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + pop_heap(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + make_heap(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + make_heap(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr I + sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr borrowed_iterator_t + sort_heap(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + template + bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last); + template + bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last); + template + constexpr RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + template + RandomAccessIterator + is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last); + template + RandomAccessIterator + is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + RandomAccessIterator first, RandomAccessIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t + is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); + } + + // [alg.min.max], minimum and maximum + template constexpr const T& min(const T& a, const T& b); + template + constexpr const T& min(const T& a, const T& b, Compare comp); + template + constexpr T min(initializer_list t); + template + constexpr T min(initializer_list t, Compare comp); + + namespace ranges { + template> Comp = ranges::less> + constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); + template> Comp = ranges::less> + constexpr T min(initializer_list r, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable, range_value_t*> + constexpr range_value_t + min(R&& r, Comp comp = {}, Proj proj = {}); + } + + template constexpr const T& max(const T& a, const T& b); + template + constexpr const T& max(const T& a, const T& b, Compare comp); + template + constexpr T max(initializer_list t); + template + constexpr T max(initializer_list t, Compare comp); + + namespace ranges { + template> Comp = ranges::less> + constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); + template> Comp = ranges::less> + constexpr T max(initializer_list r, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable, range_value_t*> + constexpr range_value_t + max(R&& r, Comp comp = {}, Proj proj = {}); + } + + template constexpr pair minmax(const T& a, const T& b); + template + constexpr pair minmax(const T& a, const T& b, Compare comp); + template + constexpr pair minmax(initializer_list t); + template + constexpr pair minmax(initializer_list t, Compare comp); + + namespace ranges { + template + using minmax_result = min_max_result; + + template> Comp = ranges::less> + constexpr minmax_result + minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); + template> Comp = ranges::less> + constexpr minmax_result + minmax(initializer_list r, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + requires indirectly_copyable_storable, range_value_t*> + constexpr minmax_result> + minmax(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last); + template + constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last, + Compare comp); + template + ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t + min_element(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last); + template + constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last, + Compare comp); + template + ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + Compare comp); + + namespace ranges { + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr borrowed_iterator_t + max_element(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr pair + minmax_element(ForwardIterator first, ForwardIterator last); + template + constexpr pair + minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); + template + pair + minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last); + template + pair + minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, Compare comp); + + namespace ranges { + template + using minmax_element_result = min_max_result; + + template S, class Proj = identity, + indirect_strict_weak_order> Comp = ranges::less> + constexpr minmax_element_result + minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); + template, Proj>> Comp = ranges::less> + constexpr minmax_element_result> + minmax_element(R&& r, Comp comp = {}, Proj proj = {}); + } + + // [alg.clamp], bounded value + template + constexpr const T& clamp(const T& v, const T& lo, const T& hi); + template + constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); + + namespace ranges { + template> Comp = ranges::less> + constexpr const T& + clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); + } + + // [alg.lex.comparison], lexicographical comparison + template + constexpr bool + lexicographical_compare(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); + template + constexpr bool + lexicographical_compare(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Compare comp); + template + bool + lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2); + template + bool + lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator1 first1, ForwardIterator1 last1, + ForwardIterator2 first2, ForwardIterator2 last2, + Compare comp); + + namespace ranges { + template S1, input_iterator I2, sentinel_for S2, + class Proj1 = identity, class Proj2 = identity, + indirect_strict_weak_order, projected> Comp = + ranges::less> + constexpr bool + lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); + template, Proj1>, + projected, Proj2>> Comp = ranges::less> + constexpr bool + lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, + Proj1 proj1 = {}, Proj2 proj2 = {}); + } + + // [alg.three.way], three-way comparison algorithms + template + constexpr auto + lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, + InputIterator2 b2, InputIterator2 e2, + Cmp comp) + -> decltype(comp(*b1, *b2)); + template + constexpr auto + lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, + InputIterator2 b2, InputIterator2 e2); + + // [alg.permutation.generators], permutations + template + constexpr bool next_permutation(BidirectionalIterator first, + BidirectionalIterator last); + template + constexpr bool next_permutation(BidirectionalIterator first, + BidirectionalIterator last, Compare comp); + + namespace ranges { + template + using next_permutation_result = in_found_result; + + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr next_permutation_result + next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr next_permutation_result> + next_permutation(R&& r, Comp comp = {}, Proj proj = {}); + } + + template + constexpr bool prev_permutation(BidirectionalIterator first, + BidirectionalIterator last); + template + constexpr bool prev_permutation(BidirectionalIterator first, + BidirectionalIterator last, Compare comp); + + namespace ranges { + template + using prev_permutation_result = in_found_result; + + template S, class Comp = ranges::less, + class Proj = identity> + requires sortable + constexpr prev_permutation_result + prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); + template + requires sortable, Comp, Proj> + constexpr prev_permutation_result> + prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); + } +} +*/ diff --git a/modules/std/std/any.hpp b/modules/std/std/any.hpp new file mode 100644 index 00000000..a02facb0 --- /dev/null +++ b/modules/std/std/any.hpp @@ -0,0 +1,16 @@ +/// \any.hpp Modularisation for https://eel.is/c++draft/any.synop +export namespace std +{ + +// [any.bad.any.cast], class bad_any_cast +using std::bad_any_cast; + +// [any.class], class any +using std::any; + +// [any.nonmembers], non-member functions +using std::any_cast; +using std::make_any; +using std::swap; + +} // namespace std diff --git a/modules/std/std/array.hpp b/modules/std/std/array.hpp new file mode 100644 index 00000000..05b8f722 --- /dev/null +++ b/modules/std/std/array.hpp @@ -0,0 +1,22 @@ +// \array.hpp Modularisation for https://eel.is/c++draft/array.syn +export namespace std +{ + +// [array], class template array +using std::array; + +using std::operator==; +using std::operator<=>; + +// [array.special], specialized algorithms +using std::swap; + +// [array.creation], array creation functions +using std::to_array; + +// [array.tuple], tuple interface +using std::tuple_size; +using std::tuple_element; +using std::get; + +} // namespace std diff --git a/modules/std/std/concepts.mxx b/modules/std/std/concepts.hpp similarity index 96% rename from modules/std/std/concepts.mxx rename to modules/std/std/concepts.hpp index 4146cf6a..3d9c7947 100644 --- a/modules/std/std/concepts.mxx +++ b/modules/std/std/concepts.hpp @@ -1,3 +1,4 @@ +// \concepts.hpp Modularisation for https://eel.is/c++draft/concepts.syn export namespace std { // [concepts.lang], language-related concepts diff --git a/modules/std/std/cstdint.mxx b/modules/std/std/cstdint.hpp similarity index 90% rename from modules/std/std/cstdint.mxx rename to modules/std/std/cstdint.hpp index 3159414e..2214e9d7 100644 --- a/modules/std/std/cstdint.mxx +++ b/modules/std/std/cstdint.hpp @@ -1,3 +1,4 @@ +// \cstdint.hpp Modularisation for https://eel.is/c++draft/cstdint.syn export namespace std { using std::int8_t; @@ -15,6 +16,9 @@ using std::int_fast16_t; using std::int_fast32_t; using std::int_fast64_t; +using std::intmax_t; +using std::intptr_t; + using std::uint_fast8_t; using std::uint_fast16_t; using std::uint_fast32_t; @@ -29,10 +33,8 @@ using std::uint_least8_t; using std::uint_least16_t; using std::uint_least32_t; using std::uint_least64_t; -using std::intmax_t; -using std::uintmax_t; -using std::intptr_t; +using std::uintmax_t; using std::uintptr_t; } diff --git a/modules/std/std/functional.mxx b/modules/std/std/functional.hpp similarity index 100% rename from modules/std/std/functional.mxx rename to modules/std/std/functional.hpp diff --git a/modules/std/std/source_location.mxx b/modules/std/std/source_location.hpp similarity index 100% rename from modules/std/std/source_location.mxx rename to modules/std/std/source_location.hpp diff --git a/modules/std/std/stacktrace.mxx b/modules/std/std/stacktrace.hpp similarity index 100% rename from modules/std/std/stacktrace.mxx rename to modules/std/std/stacktrace.hpp diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index 024ce41d..95621f28 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -1,6 +1,7 @@ module; +#include #include #include #include @@ -12,6 +13,7 @@ module; export module std; +#include "any.mxx" #include "cstdint.mxx" #include "concepts.mxx" #include "functional.mxx" diff --git a/modules/std/std/string.mxx b/modules/std/std/string.hpp similarity index 83% rename from modules/std/std/string.mxx rename to modules/std/std/string.hpp index 48bfcf7f..5704a5a7 100644 --- a/modules/std/std/string.mxx +++ b/modules/std/std/string.hpp @@ -1,3 +1,4 @@ +/// \string.hpp Modularisation for https://eel.is/c++draft/string.syn export namespace std { diff --git a/modules/std/std/string_view.mxx b/modules/std/std/string_view.hpp similarity index 81% rename from modules/std/std/string_view.mxx rename to modules/std/std/string_view.hpp index c8c1ba64..2d8891c2 100644 --- a/modules/std/std/string_view.mxx +++ b/modules/std/std/string_view.hpp @@ -1,3 +1,4 @@ +/// \string_view.hpp Modularisation for https://eel.is/c++draft/string_view.syn export namespace std { diff --git a/modules/std/std/thread.mxx b/modules/std/std/thread.hpp similarity index 91% rename from modules/std/std/thread.mxx rename to modules/std/std/thread.hpp index 9624388f..c7d7065a 100644 --- a/modules/std/std/thread.mxx +++ b/modules/std/std/thread.hpp @@ -1,3 +1,4 @@ +/// \thread.hpp Modularisation for https://eel.is/c++draft/thread.syn export namespace std { diff --git a/modules/std/std/type_traits.mxx b/modules/std/std/type_traits.hpp similarity index 99% rename from modules/std/std/type_traits.mxx rename to modules/std/std/type_traits.hpp index 35ca4f2d..97c487b0 100644 --- a/modules/std/std/type_traits.mxx +++ b/modules/std/std/type_traits.hpp @@ -1,3 +1,4 @@ +/// \type_traits.hpp Modularisation for https://eel.is/c++draft/meta.type.synop export namespace std { diff --git a/modules/std/std/vector.hpp b/modules/std/std/vector.hpp new file mode 100644 index 00000000..0c60790f --- /dev/null +++ b/modules/std/std/vector.hpp @@ -0,0 +1,31 @@ +/// \vector.hpp Modularisation for https://eel.is/c++draft/vector.syn +export namespace std +{ + +// [vector], class template vector +using std::vector; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [vector.erasure], erasure +using std::erase; +using std::erase_if; + +namespace pmr { + using std::pmr::vector; +} + +// hash support +using std::hash; + +#if (__cpp_lib_format_ranges >= 202207L) + + // [vector.bool.fmt], formatter specialization for vector + using std::formatter; + +#endif // #if (__cpp_lib_format_ranges >= 202207L) + +} // namespace std From b07bd8d802a98d8b46b5940bd76159dc64c92a4a Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 14 Apr 2024 21:25:48 +0100 Subject: [PATCH 07/14] Complete modularisation of the algorithm header --- modules/std/std/algorithm.hpp | 1841 ++++++--------------------------- modules/std/std/bit.hpp | 31 + modules/std/std/std.ixx | 26 +- 3 files changed, 358 insertions(+), 1540 deletions(-) create mode 100644 modules/std/std/bit.hpp diff --git a/modules/std/std/algorithm.hpp b/modules/std/std/algorithm.hpp index 70810240..ec70761a 100644 --- a/modules/std/std/algorithm.hpp +++ b/modules/std/std/algorithm.hpp @@ -269,1536 +269,315 @@ using std::ranges::binary_transform_result; } // namespace ranges -} // namespace std +// [alg.replace], replace +using std::replace; +using std::replace_if; +using std::replace_copy; +using std::replace_copy_if; +namespace ranges +{ -/* -namespace std { - - - // [alg.replace], replace - template - constexpr void replace(ForwardIterator first, ForwardIterator last, - const T& old_value, const T& new_value); - template - void replace(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - const T& old_value, const T& new_value); - template - constexpr void replace_if(ForwardIterator first, ForwardIterator last, - Predicate pred, const T& new_value); - template - void replace_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Predicate pred, const T& new_value); - - namespace ranges { - template S, class T1, class T2, class Proj = identity> - requires indirectly_writable && - indirect_binary_predicate, const T1*> - constexpr I - replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); - template - requires indirectly_writable, const T2&> && - indirect_binary_predicate, Proj>, const T1*> - constexpr borrowed_iterator_t - replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); - template S, class T, class Proj = identity, - indirect_unary_predicate> Pred> - requires indirectly_writable - constexpr I replace_if(I first, S last, Pred pred, const T& new_value, Proj proj = {}); - template, Proj>> Pred> - requires indirectly_writable, const T&> - constexpr borrowed_iterator_t - replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); - } - - template - constexpr OutputIterator replace_copy(InputIterator first, InputIterator last, - OutputIterator result, - const T& old_value, const T& new_value); - template - ForwardIterator2 replace_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - const T& old_value, const T& new_value); - template - constexpr OutputIterator replace_copy_if(InputIterator first, InputIterator last, - OutputIterator result, - Predicate pred, const T& new_value); - template - ForwardIterator2 replace_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, - Predicate pred, const T& new_value); - - namespace ranges { - template - using replace_copy_result = in_out_result; - - template S, class T1, class T2, - output_iterator O, class Proj = identity> - requires indirectly_copyable && - indirect_binary_predicate, const T1*> - constexpr replace_copy_result - replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); - template O, - class Proj = identity> - requires indirectly_copyable, O> && - indirect_binary_predicate, Proj>, const T1*> - constexpr replace_copy_result, O> - replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); - - template - using replace_copy_if_result = in_out_result; - - template S, class T, output_iterator O, - class Proj = identity, indirect_unary_predicate> Pred> - requires indirectly_copyable - constexpr replace_copy_if_result - replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, - Proj proj = {}); - template O, class Proj = identity, - indirect_unary_predicate, Proj>> Pred> - requires indirectly_copyable, O> - constexpr replace_copy_if_result, O> - replace_copy_if(R&& r, O result, Pred pred, const T& new_value, - Proj proj = {}); - } - - // [alg.fill], fill - template - constexpr void fill(ForwardIterator first, ForwardIterator last, const T& value); - template - void fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, const T& value); - template - constexpr OutputIterator fill_n(OutputIterator first, Size n, const T& value); // freestanding - template - ForwardIterator fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, Size n, const T& value); - - namespace ranges { - template O, sentinel_for S> - constexpr O fill(O first, S last, const T& value); - template R> - constexpr borrowed_iterator_t fill(R&& r, const T& value); - template O> - constexpr O fill_n(O first, iter_difference_t n, const T& value); - } - - // [alg.generate], generate - template - constexpr void generate(ForwardIterator first, ForwardIterator last, - Generator gen); - template - void generate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Generator gen); - template - constexpr OutputIterator generate_n(OutputIterator first, Size n, Generator gen); - template - ForwardIterator generate_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, Size n, Generator gen); - - namespace ranges { - template S, copy_constructible F> - requires invocable && indirectly_writable> - constexpr O generate(O first, S last, F gen); - template - requires invocable && output_range> - constexpr borrowed_iterator_t generate(R&& r, F gen); - template - requires invocable && indirectly_writable> - constexpr O generate_n(O first, iter_difference_t n, F gen); - } - - // [alg.remove], remove - template - constexpr ForwardIterator remove(ForwardIterator first, ForwardIterator last, - const T& value); - template - ForwardIterator remove(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - const T& value); - template - constexpr ForwardIterator remove_if(ForwardIterator first, ForwardIterator last, - Predicate pred); - template - ForwardIterator remove_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Predicate pred); - - namespace ranges { - template S, class T, class Proj = identity> - requires indirect_binary_predicate, const T*> - constexpr subrange remove(I first, S last, const T& value, Proj proj = {}); - template - requires permutable> && - indirect_binary_predicate, Proj>, const T*> - constexpr borrowed_subrange_t - remove(R&& r, const T& value, Proj proj = {}); - template S, class Proj = identity, - indirect_unary_predicate> Pred> - constexpr subrange remove_if(I first, S last, Pred pred, Proj proj = {}); - template, Proj>> Pred> - requires permutable> - constexpr borrowed_subrange_t - remove_if(R&& r, Pred pred, Proj proj = {}); - } - - template - constexpr OutputIterator - remove_copy(InputIterator first, InputIterator last, - OutputIterator result, const T& value); - template - ForwardIterator2 - remove_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, const T& value); - template - constexpr OutputIterator - remove_copy_if(InputIterator first, InputIterator last, - OutputIterator result, Predicate pred); - template - ForwardIterator2 - remove_copy_if(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, Predicate pred); - - namespace ranges { - template - using remove_copy_result = in_out_result; - - template S, weakly_incrementable O, class T, - class Proj = identity> - requires indirectly_copyable && - indirect_binary_predicate, const T*> - constexpr remove_copy_result - remove_copy(I first, S last, O result, const T& value, Proj proj = {}); - template - requires indirectly_copyable, O> && - indirect_binary_predicate, Proj>, const T*> - constexpr remove_copy_result, O> - remove_copy(R&& r, O result, const T& value, Proj proj = {}); - - template - using remove_copy_if_result = in_out_result; - - template S, weakly_incrementable O, - class Proj = identity, indirect_unary_predicate> Pred> - requires indirectly_copyable - constexpr remove_copy_if_result - remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); - template, Proj>> Pred> - requires indirectly_copyable, O> - constexpr remove_copy_if_result, O> - remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); - } - - // [alg.unique], unique - template - constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last); - template - constexpr ForwardIterator unique(ForwardIterator first, ForwardIterator last, - BinaryPredicate pred); - template - ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - ForwardIterator unique(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - BinaryPredicate pred); - - namespace ranges { - template S, class Proj = identity, - indirect_equivalence_relation> C = ranges::equal_to> - constexpr subrange unique(I first, S last, C comp = {}, Proj proj = {}); - template, Proj>> C = ranges::equal_to> - requires permutable> - constexpr borrowed_subrange_t - unique(R&& r, C comp = {}, Proj proj = {}); - } - - template - constexpr OutputIterator - unique_copy(InputIterator first, InputIterator last, - OutputIterator result); - template - constexpr OutputIterator - unique_copy(InputIterator first, InputIterator last, - OutputIterator result, BinaryPredicate pred); - template - ForwardIterator2 - unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result); - template - ForwardIterator2 - unique_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 last, - ForwardIterator2 result, BinaryPredicate pred); - - namespace ranges { - template - using unique_copy_result = in_out_result; - - template S, weakly_incrementable O, class Proj = identity, - indirect_equivalence_relation> C = ranges::equal_to> - requires indirectly_copyable && - (forward_iterator || - (input_iterator && same_as, iter_value_t>) || - indirectly_copyable_storable) - constexpr unique_copy_result - unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); - template, Proj>> C = ranges::equal_to> - requires indirectly_copyable, O> && - (forward_iterator> || - (input_iterator && same_as, iter_value_t>) || - indirectly_copyable_storable, O>) - constexpr unique_copy_result, O> - unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); - } - - // [alg.reverse], reverse - template - constexpr void reverse(BidirectionalIterator first, BidirectionalIterator last); - template - void reverse(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - BidirectionalIterator first, BidirectionalIterator last); - - namespace ranges { - template S> - requires permutable - constexpr I reverse(I first, S last); - template - requires permutable> - constexpr borrowed_iterator_t reverse(R&& r); - } - - template - constexpr OutputIterator - reverse_copy(BidirectionalIterator first, BidirectionalIterator last, - OutputIterator result); - template - ForwardIterator - reverse_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - BidirectionalIterator first, BidirectionalIterator last, - ForwardIterator result); - - namespace ranges { - template - using reverse_copy_result = in_out_result; - - template S, weakly_incrementable O> - requires indirectly_copyable - constexpr reverse_copy_result - reverse_copy(I first, S last, O result); - template - requires indirectly_copyable, O> - constexpr reverse_copy_result, O> - reverse_copy(R&& r, O result); - } - - // [alg.rotate], rotate - template - constexpr ForwardIterator rotate(ForwardIterator first, - ForwardIterator middle, - ForwardIterator last); - template - ForwardIterator rotate(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, - ForwardIterator middle, - ForwardIterator last); - - namespace ranges { - template S> - constexpr subrange rotate(I first, I middle, S last); - template - requires permutable> - constexpr borrowed_subrange_t rotate(R&& r, iterator_t middle); - } - - template - constexpr OutputIterator - rotate_copy(ForwardIterator first, ForwardIterator middle, - ForwardIterator last, OutputIterator result); - template - ForwardIterator2 - rotate_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first, ForwardIterator1 middle, - ForwardIterator1 last, ForwardIterator2 result); - - namespace ranges { - template - using rotate_copy_result = in_out_result; - - template S, weakly_incrementable O> - requires indirectly_copyable - constexpr rotate_copy_result - rotate_copy(I first, I middle, S last, O result); - template - requires indirectly_copyable, O> - constexpr rotate_copy_result, O> - rotate_copy(R&& r, iterator_t middle, O result); - } - - // [alg.random.sample], sample - template - SampleIterator sample(PopulationIterator first, PopulationIterator last, - SampleIterator out, Distance n, - UniformRandomBitGenerator&& g); - - namespace ranges { - template S, - weakly_incrementable O, class Gen> - requires (forward_iterator || random_access_iterator) && - indirectly_copyable && - uniform_random_bit_generator> - O sample(I first, S last, O out, iter_difference_t n, Gen&& g); - template - requires (forward_range || random_access_iterator) && - indirectly_copyable, O> && - uniform_random_bit_generator> - O sample(R&& r, O out, range_difference_t n, Gen&& g); - } - - // [alg.random.shuffle], shuffle - template - void shuffle(RandomAccessIterator first, - RandomAccessIterator last, - UniformRandomBitGenerator&& g); - - namespace ranges { - template S, class Gen> - requires permutable && - uniform_random_bit_generator> - I shuffle(I first, S last, Gen&& g); - template - requires permutable> && - uniform_random_bit_generator> - borrowed_iterator_t shuffle(R&& r, Gen&& g); - } - - // [alg.shift], shift - template - constexpr ForwardIterator - shift_left(ForwardIterator first, ForwardIterator last, - typename iterator_traits::difference_type n); - template - ForwardIterator - shift_left(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - typename iterator_traits::difference_type n); - - namespace ranges { - template S> - constexpr subrange shift_left(I first, S last, iter_difference_t n); - template - requires permutable> - constexpr borrowed_subrange_t shift_left(R&& r, range_difference_t n); - } - - template - constexpr ForwardIterator - shift_right(ForwardIterator first, ForwardIterator last, - typename iterator_traits::difference_type n); - template - ForwardIterator - shift_right(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - typename iterator_traits::difference_type n); - - namespace ranges { - template S> - constexpr subrange shift_right(I first, S last, iter_difference_t n); - template - requires permutable> - constexpr borrowed_subrange_t shift_right(R&& r, range_difference_t n); - } - - // [alg.sorting], sorting and related operations - // [alg.sort], sorting - template - constexpr void sort(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void sort(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - template - void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last); - template - void sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - sort(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - sort(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void stable_sort(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - template - void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last); - template - void stable_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - stable_sort(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last); - template - constexpr void partial_sort(RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last, Compare comp); - template - void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last); - template - void partial_sort(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator middle, - RandomAccessIterator last, Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - partial_sort(R&& r, iterator_t middle, Comp comp = {}, - Proj proj = {}); - } - - template - constexpr RandomAccessIterator - partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last); - template - constexpr RandomAccessIterator - partial_sort_copy(InputIterator first, InputIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, - Compare comp); - template - RandomAccessIterator - partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last); - template - RandomAccessIterator - partial_sort_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - RandomAccessIterator result_first, - RandomAccessIterator result_last, - Compare comp); - - namespace ranges { - template - using partial_sort_copy_result = in_out_result; - - template S1, - random_access_iterator I2, sentinel_for S2, - class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> - requires indirectly_copyable && sortable && - indirect_strict_weak_order, projected> - constexpr partial_sort_copy_result - partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template - requires indirectly_copyable, iterator_t> && - sortable, Comp, Proj2> && - indirect_strict_weak_order, Proj1>, - projected, Proj2>> - constexpr partial_sort_copy_result, borrowed_iterator_t> - partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr bool is_sorted(ForwardIterator first, ForwardIterator last); - template - constexpr bool is_sorted(ForwardIterator first, ForwardIterator last, - Compare comp); - template - bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - bool is_sorted(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr ForwardIterator - is_sorted_until(ForwardIterator first, ForwardIterator last); - template - constexpr ForwardIterator - is_sorted_until(ForwardIterator first, ForwardIterator last, - Compare comp); - template - ForwardIterator - is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - ForwardIterator - is_sorted_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t - is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); - } - - // [alg.nth.element], Nth element - template - constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last); - template - constexpr void nth_element(RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, Compare comp); - template - void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last); - template - void nth_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator nth, - RandomAccessIterator last, Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); - } - - // [alg.binary.search], binary search - template - constexpr ForwardIterator - lower_bound(ForwardIterator first, ForwardIterator last, - const T& value); - template - constexpr ForwardIterator - lower_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); - - namespace ranges { - template S, class T, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); - template, Proj>> Comp = - ranges::less> - constexpr borrowed_iterator_t - lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); - } - - template - constexpr ForwardIterator - upper_bound(ForwardIterator first, ForwardIterator last, - const T& value); - template - constexpr ForwardIterator - upper_bound(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); - - namespace ranges { - template S, class T, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = - ranges::less> - constexpr borrowed_iterator_t - upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); - } - - template - constexpr pair - equal_range(ForwardIterator first, ForwardIterator last, - const T& value); - template - constexpr pair - equal_range(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); - - namespace ranges { - template S, class T, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr subrange - equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = - ranges::less> - constexpr borrowed_subrange_t - equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); - } - - template - constexpr bool - binary_search(ForwardIterator first, ForwardIterator last, - const T& value); - template - constexpr bool - binary_search(ForwardIterator first, ForwardIterator last, - const T& value, Compare comp); - - namespace ranges { - template S, class T, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); - template, Proj>> Comp = - ranges::less> - constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, - Proj proj = {}); - } - - // [alg.partitions], partitions - template - constexpr bool is_partitioned(InputIterator first, InputIterator last, Predicate pred); - template - bool is_partitioned(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, Predicate pred); - - namespace ranges { - template S, class Proj = identity, - indirect_unary_predicate> Pred> - constexpr bool is_partitioned(I first, S last, Pred pred, Proj proj = {}); - template, Proj>> Pred> - constexpr bool is_partitioned(R&& r, Pred pred, Proj proj = {}); - } - - template - constexpr ForwardIterator partition(ForwardIterator first, - ForwardIterator last, - Predicate pred); - template - ForwardIterator partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, - ForwardIterator last, - Predicate pred); - - namespace ranges { - template S, class Proj = identity, - indirect_unary_predicate> Pred> - constexpr subrange - partition(I first, S last, Pred pred, Proj proj = {}); - template, Proj>> Pred> - requires permutable> - constexpr borrowed_subrange_t - partition(R&& r, Pred pred, Proj proj = {}); - } - - template - constexpr BidirectionalIterator stable_partition(BidirectionalIterator first, - BidirectionalIterator last, - Predicate pred); - template - BidirectionalIterator stable_partition(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - BidirectionalIterator first, - BidirectionalIterator last, - Predicate pred); - - namespace ranges { - template S, class Proj = identity, - indirect_unary_predicate> Pred> - requires permutable - constexpr subrange stable_partition(I first, S last, Pred pred, Proj proj = {}); - template, Proj>> Pred> - requires permutable> - constexpr borrowed_subrange_t stable_partition(R&& r, Pred pred, Proj proj = {}); - } - - template - constexpr pair - partition_copy(InputIterator first, InputIterator last, - OutputIterator1 out_true, OutputIterator2 out_false, - Predicate pred); - template - pair - partition_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - ForwardIterator1 out_true, ForwardIterator2 out_false, - Predicate pred); - - namespace ranges { - template - using partition_copy_result = in_out_out_result; - - template S, - weakly_incrementable O1, weakly_incrementable O2, - class Proj = identity, indirect_unary_predicate> Pred> - requires indirectly_copyable && indirectly_copyable - constexpr partition_copy_result - partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, - Proj proj = {}); - template, Proj>> Pred> - requires indirectly_copyable, O1> && - indirectly_copyable, O2> - constexpr partition_copy_result, O1, O2> - partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); - } - - template - constexpr ForwardIterator - partition_point(ForwardIterator first, ForwardIterator last, - Predicate pred); - - namespace ranges { - template S, class Proj = identity, - indirect_unary_predicate> Pred> - constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); - template, Proj>> Pred> - constexpr borrowed_iterator_t - partition_point(R&& r, Pred pred, Proj proj = {}); - } - - // [alg.merge], merge - template - constexpr OutputIterator - merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); - template - constexpr OutputIterator - merge(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); - template - ForwardIterator - merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result); - template - ForwardIterator - merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result, Compare comp); - - namespace ranges { - template - using merge_result = in_in_out_result; - - template S1, input_iterator I2, sentinel_for S2, - weakly_incrementable O, class Comp = ranges::less, class Proj1 = identity, - class Proj2 = identity> - requires mergeable - constexpr merge_result - merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template - requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr merge_result, borrowed_iterator_t, O> - merge(R1&& r1, R2&& r2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last); - template - constexpr void inplace_merge(BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Compare comp); - template - void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last); - template - void inplace_merge(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - BidirectionalIterator first, - BidirectionalIterator middle, - BidirectionalIterator last, Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - inplace_merge(R&& r, iterator_t middle, Comp comp = {}, - Proj proj = {}); - } - - // [alg.set.operations], set operations - template - constexpr bool includes(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); - template - constexpr bool includes(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Compare comp); - template - bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2); - template - bool includes(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Compare comp); - - namespace ranges { - template S1, input_iterator I2, sentinel_for S2, - class Proj1 = identity, class Proj2 = identity, - indirect_strict_weak_order, projected> Comp = - ranges::less> - constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - template, Proj1>, - projected, Proj2>> Comp = ranges::less> - constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr OutputIterator - set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); - template - constexpr OutputIterator - set_union(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); - template - ForwardIterator - set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result); - template - ForwardIterator - set_union(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result, Compare comp); - - namespace ranges { - template - using set_union_result = in_in_out_result; - - template S1, input_iterator I2, sentinel_for S2, - weakly_incrementable O, class Comp = ranges::less, - class Proj1 = identity, class Proj2 = identity> - requires mergeable - constexpr set_union_result - set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - template - requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_union_result, borrowed_iterator_t, O> - set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr OutputIterator - set_intersection(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); - template - constexpr OutputIterator - set_intersection(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); - template - ForwardIterator - set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result); - template - ForwardIterator - set_intersection(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result, Compare comp); - - namespace ranges { - template - using set_intersection_result = in_in_out_result; - - template S1, input_iterator I2, sentinel_for S2, - weakly_incrementable O, class Comp = ranges::less, - class Proj1 = identity, class Proj2 = identity> - requires mergeable - constexpr set_intersection_result - set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template - requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_intersection_result, borrowed_iterator_t, O> - set_intersection(R1&& r1, R2&& r2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr OutputIterator - set_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); - template - constexpr OutputIterator - set_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); - template - ForwardIterator - set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result); - template - ForwardIterator - set_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result, Compare comp); - - namespace ranges { - template - using set_difference_result = in_out_result; - - template S1, input_iterator I2, sentinel_for S2, - weakly_incrementable O, class Comp = ranges::less, - class Proj1 = identity, class Proj2 = identity> - requires mergeable - constexpr set_difference_result - set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template - requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_difference_result, O> - set_difference(R1&& r1, R2&& r2, O result, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - template - constexpr OutputIterator - set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result); - template - constexpr OutputIterator - set_symmetric_difference(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - OutputIterator result, Compare comp); - template - ForwardIterator - set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result); - template - ForwardIterator - set_symmetric_difference(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - ForwardIterator result, Compare comp); - - namespace ranges { - template - using set_symmetric_difference_result = in_in_out_result; - - template S1, input_iterator I2, sentinel_for S2, - weakly_incrementable O, class Comp = ranges::less, - class Proj1 = identity, class Proj2 = identity> - requires mergeable - constexpr set_symmetric_difference_result - set_symmetric_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, - Comp comp = {}, Proj1 proj1 = {}, - Proj2 proj2 = {}); - template - requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_symmetric_difference_result, - borrowed_iterator_t, O> - set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - // [alg.heap.operations], heap operations - template - constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void push_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - push_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - push_heap(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void pop_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - pop_heap(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void make_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - make_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - make_heap(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr void sort_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr I - sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr borrowed_iterator_t - sort_heap(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr bool is_heap(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - template - bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last); - template - bool is_heap(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr RandomAccessIterator - is_heap_until(RandomAccessIterator first, RandomAccessIterator last); - template - constexpr RandomAccessIterator - is_heap_until(RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - template - RandomAccessIterator - is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last); - template - RandomAccessIterator - is_heap_until(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - RandomAccessIterator first, RandomAccessIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t - is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); - } - - // [alg.min.max], minimum and maximum - template constexpr const T& min(const T& a, const T& b); - template - constexpr const T& min(const T& a, const T& b, Compare comp); - template - constexpr T min(initializer_list t); - template - constexpr T min(initializer_list t, Compare comp); - - namespace ranges { - template> Comp = ranges::less> - constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); - template> Comp = ranges::less> - constexpr T min(initializer_list r, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - requires indirectly_copyable_storable, range_value_t*> - constexpr range_value_t - min(R&& r, Comp comp = {}, Proj proj = {}); - } - - template constexpr const T& max(const T& a, const T& b); - template - constexpr const T& max(const T& a, const T& b, Compare comp); - template - constexpr T max(initializer_list t); - template - constexpr T max(initializer_list t, Compare comp); - - namespace ranges { - template> Comp = ranges::less> - constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); - template> Comp = ranges::less> - constexpr T max(initializer_list r, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - requires indirectly_copyable_storable, range_value_t*> - constexpr range_value_t - max(R&& r, Comp comp = {}, Proj proj = {}); - } - - template constexpr pair minmax(const T& a, const T& b); - template - constexpr pair minmax(const T& a, const T& b, Compare comp); - template - constexpr pair minmax(initializer_list t); - template - constexpr pair minmax(initializer_list t, Compare comp); - - namespace ranges { - template - using minmax_result = min_max_result; - - template> Comp = ranges::less> - constexpr minmax_result - minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); - template> Comp = ranges::less> - constexpr minmax_result - minmax(initializer_list r, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - requires indirectly_copyable_storable, range_value_t*> - constexpr minmax_result> - minmax(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last); - template - constexpr ForwardIterator min_element(ForwardIterator first, ForwardIterator last, - Compare comp); - template - ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - ForwardIterator min_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t - min_element(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last); - template - constexpr ForwardIterator max_element(ForwardIterator first, ForwardIterator last, - Compare comp); - template - ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - ForwardIterator max_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, - Compare comp); - - namespace ranges { - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t - max_element(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr pair - minmax_element(ForwardIterator first, ForwardIterator last); - template - constexpr pair - minmax_element(ForwardIterator first, ForwardIterator last, Compare comp); - template - pair - minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last); - template - pair - minmax_element(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator first, ForwardIterator last, Compare comp); - - namespace ranges { - template - using minmax_element_result = min_max_result; - - template S, class Proj = identity, - indirect_strict_weak_order> Comp = ranges::less> - constexpr minmax_element_result - minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); - template, Proj>> Comp = ranges::less> - constexpr minmax_element_result> - minmax_element(R&& r, Comp comp = {}, Proj proj = {}); - } - - // [alg.clamp], bounded value - template - constexpr const T& clamp(const T& v, const T& lo, const T& hi); - template - constexpr const T& clamp(const T& v, const T& lo, const T& hi, Compare comp); - - namespace ranges { - template> Comp = ranges::less> - constexpr const T& - clamp(const T& v, const T& lo, const T& hi, Comp comp = {}, Proj proj = {}); - } - - // [alg.lex.comparison], lexicographical comparison - template - constexpr bool - lexicographical_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2); - template - constexpr bool - lexicographical_compare(InputIterator1 first1, InputIterator1 last1, - InputIterator2 first2, InputIterator2 last2, - Compare comp); - template - bool - lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2); - template - bool - lexicographical_compare(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] - ForwardIterator1 first1, ForwardIterator1 last1, - ForwardIterator2 first2, ForwardIterator2 last2, - Compare comp); - - namespace ranges { - template S1, input_iterator I2, sentinel_for S2, - class Proj1 = identity, class Proj2 = identity, - indirect_strict_weak_order, projected> Comp = - ranges::less> - constexpr bool - lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, Proj1>, - projected, Proj2>> Comp = ranges::less> - constexpr bool - lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); - } - - // [alg.three.way], three-way comparison algorithms - template - constexpr auto - lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, - InputIterator2 b2, InputIterator2 e2, - Cmp comp) - -> decltype(comp(*b1, *b2)); - template - constexpr auto - lexicographical_compare_three_way(InputIterator1 b1, InputIterator1 e1, - InputIterator2 b2, InputIterator2 e2); - - // [alg.permutation.generators], permutations - template - constexpr bool next_permutation(BidirectionalIterator first, - BidirectionalIterator last); - template - constexpr bool next_permutation(BidirectionalIterator first, - BidirectionalIterator last, Compare comp); - - namespace ranges { - template - using next_permutation_result = in_found_result; - - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr next_permutation_result - next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr next_permutation_result> - next_permutation(R&& r, Comp comp = {}, Proj proj = {}); - } - - template - constexpr bool prev_permutation(BidirectionalIterator first, - BidirectionalIterator last); - template - constexpr bool prev_permutation(BidirectionalIterator first, - BidirectionalIterator last, Compare comp); - - namespace ranges { - template - using prev_permutation_result = in_found_result; - - template S, class Comp = ranges::less, - class Proj = identity> - requires sortable - constexpr prev_permutation_result - prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template - requires sortable, Comp, Proj> - constexpr prev_permutation_result> - prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); - } -} -*/ +using std::ranges::replace; +using std::ranges::replace_if; +using std::ranges::replace_copy; +using std::ranges::replace_copy_result; +using std::ranges::replace_copy_if; +using std::ranges::replace_copy_if_result; + +} // namespace ranges + +// [alg.fill], fill +using std::fill; +using std::fill_n; + +namespace ranges +{ + +using std::ranges::fill; +using std::ranges::fill_n; + +} // namespace ranges + +// [alg.generate], generate +using std::generate; +using std::generate_n; + +namespace ranges +{ + +using std::ranges::generate; +using std::ranges::generate_n; + +} // namespace ranges + +// [alg.remove], remove +using std::remove; +using std::remove_if; +using std::remove_copy; +using std::remove_copy_if; + +namespace ranges +{ + +using std::ranges::remove; +using std::ranges::remove_if; +using std::ranges::remove_copy; +using std::ranges::remove_copy_result; +using std::ranges::remove_copy_if; +using std::ranges::remove_copy_if_result; + +} // namespace ranges + +// [alg.unique], unique +using std::unique; +using std::unique_copy; + +namespace ranges +{ + +using std::ranges::unique; +using std::ranges::unique_copy; + +} // namespace ranges + +// [alg.reverse], reverse +using std::reverse; +using std::reverse_copy; + +namespace ranges +{ + +using std::ranges::reverse; +using std::ranges::reverse_copy; +using std::ranges::reverse_copy_result; + +} // namespace ranges + +// [alg.rotate], rotate +using std::rotate; +using std::rotate_copy; + +namespace ranges +{ + +using std::ranges::rotate; +using std::ranges::rotate_copy; +using std::ranges::rotate_copy_result; + +} // namespace ranges + +// [alg.random.sample], sample +using std::sample; + +namespace ranges +{ + +using std::ranges::sample; + +} // namespace ranges + +// [alg.random.shuffle], shuffle +using std::shuffle; + +namespace ranges +{ + +using std::ranges::shuffle; + +} // namespace ranges + +// [alg.shift], shift +using std::shift_left; +using std::shift_right; + +namespace ranges +{ + +using std::ranges::shift_left; +using std::ranges::shift_right; + +} // namespace ranges + +// [alg.sorting], sorting and related operations +// [alg.sort], sorting +using std::sort; +using std::stable_sort; +using std::partial_sort; +using std::partial_sort_copy; +using std::is_sorted; +using std::is_sorted_until; + +namespace ranges +{ + +using std::ranges::sort; +using std::ranges::stable_sort; +using std::ranges::partial_sort; +using std::ranges::partial_sort_copy; +using std::ranges::partial_sort_copy_result; +using std::ranges::is_sorted; +using std::ranges::is_sorted_until; + +} // namespace ranges + +// [alg.nth.element], Nth element +using std::nth_element; + +namespace ranges +{ + +using std::ranges::nth_element; + +} // namespace ranges + +// [alg.binary.search], binary search +using std::lower_bound; +using std::upper_bound; +using std::equal_range; +using std::binary_search; + +namespace ranges +{ + +using std::ranges::lower_bound; +using std::ranges::upper_bound; +using std::ranges::equal_range; +using std::ranges::binary_search; + +} // namespace ranges + +// [alg.partitions], partitions +using std::is_partitioned; +using std::partition; +using std::stable_partition; +using std::partition_copy; +using std::partition_point; + +namespace ranges +{ + +using std::ranges::is_partitioned; +using std::ranges::partition; +using std::ranges::stable_partition; +using std::ranges::partition_copy; +using std::ranges::partition_copy_result; +using std::ranges::partition_point; + +} // namespace ranges + +// [alg.merge], merge +using std::merge; +using std::inplace_merge; + +namespace ranges +{ + +using std::ranges::merge; +using std::ranges::merge_result; +using std::ranges::inplace_merge; + +} // namespace ranges + +// [alg.set.operations], set operations +using std::includes; +using std::set_union; +using std::set_intersection; +using std::set_difference; +using std::set_symmetric_difference; + +namespace ranges +{ + +using std::ranges::includes; +using std::ranges::set_union; +using std::ranges::set_union_result; +using std::ranges::set_intersection; +using std::ranges::set_intersection_result; +using std::ranges::set_difference; +using std::ranges::set_difference_result; +using std::ranges::set_symmetric_difference; +using std::ranges::set_symmetric_difference_result; + +} // namespace ranges + +// [alg.heap.operations], heap operations +using std::push_heap; +using std::pop_heap; +using std::make_heap; +using std::sort_heap; +using std::is_heap; +using std::is_heap_until; + +namespace ranges +{ + +using std::ranges::push_heap; +using std::ranges::pop_heap; +using std::ranges::make_heap; +using std::ranges::sort_heap; +using std::ranges::is_heap; +using std::ranges::is_heap_until; + +} // namespace ranges + +// [alg.min.max], minimum and maximum +using std::min; +using std::max; +using std::minmax; +using std::min_element; +using std::max_element; +using std::minmax_element; + +namespace ranges +{ + +using std::ranges::min; +using std::ranges::max; +using std::ranges::minmax; +using std::ranges::minmax_result; +using std::ranges::min_element; +using std::ranges::max_element; +using std::ranges::minmax_element; +using std::ranges::minmax_element_result; + +} // namespace ranges + +// [alg.clamp], bounded value +using std::clamp; + +namespace ranges +{ + +using std::ranges::clamp; + +} // namespace ranges + +// [alg.lex.comparison], lexicographical comparison +using std::lexicographical_compare; + +namespace ranges +{ + +using std::ranges::lexicographical_compare; + +} // namespace ranges + +// [alg.three.way], three-way comparison algorithms +using std::lexicographical_compare_three_way; + +// [alg.permutation.generators], permutations +using std::next_permutation; +using std::prev_permutation; + +namespace ranges +{ + +using std::ranges::next_permutation; +using std::ranges::next_permutation_result; +using std::ranges::prev_permutation; +using std::ranges::prev_permutation_result; + +} // namespace ranges + +} // namespace std diff --git a/modules/std/std/bit.hpp b/modules/std/std/bit.hpp new file mode 100644 index 00000000..62d8ac01 --- /dev/null +++ b/modules/std/std/bit.hpp @@ -0,0 +1,31 @@ +// \bit.hpp Modularisation for https://eel.is/c++draft/bit.syn +export namespace std +{ + +// [bit.cast], bit_cast +using std::bit_cast; + +// [bit.byteswap], byteswap +using std::byteswap; + +// [bit.pow.two], integral powers of 2 +using std::has_single_bit; +using std::bit_ceil; +using std::bit_floor; +using std::bit_width; + +// [bit.rotate], rotating +using std::rotl; +using std::rotr; + +// [bit.count], counting +using std::countl_zero; +using std::countl_one; +using std::countr_zero; +using std::countr_one; +using std::popcount; + +// [bit.endian], endian +using std::endian; + +} // namespace std diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index 95621f28..4e4fd7d6 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -1,7 +1,10 @@ module; +#include #include +#include +#include #include #include #include @@ -10,18 +13,23 @@ module; #include #include #include +#include export module std; -#include "any.mxx" -#include "cstdint.mxx" -#include "concepts.mxx" -#include "functional.mxx" -#include "string.mxx" -#include "source_location.mxx" -#include "stacktrace.mxx" -#include "string_view.mxx" -#include "type_traits.mxx" +#include "algorithm.hpp" +#include "any.hpp" +#include "array.hpp" +#include "bit.hpp" +#include "cstdint.hpp" +#include "concepts.hpp" +#include "functional.hpp" +#include "string.hpp" +#include "source_location.hpp" +#include "stacktrace.hpp" +#include "string_view.hpp" +#include "type_traits.hpp" +#include "vector.hpp" #pragma warning(push) #pragma warning(disable : 5244) // '#include ' in the purview of module 'std' appears erroneous. From 588d74c232e2beb34f24b8abfc3e41b3d3ab0779 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Thu, 18 Apr 2024 20:49:36 +0100 Subject: [PATCH 08/14] Modularise atomic --- modules/std/std/atomic.hpp | 129 +++++++++++++++++++++++++++++++++++++ modules/std/std/std.ixx | 2 + 2 files changed, 131 insertions(+) create mode 100644 modules/std/std/atomic.hpp diff --git a/modules/std/std/atomic.hpp b/modules/std/std/atomic.hpp new file mode 100644 index 00000000..2e3ba9df --- /dev/null +++ b/modules/std/std/atomic.hpp @@ -0,0 +1,129 @@ +// \atomic.hpp Modularisation for https://eel.is/c++draft/atomics.syn +export namespace std +{ + +// [atomics.order], order and consistency +using std::memory_order; +using std::memory_order_acq_rel; +using std::memory_order_acquire; +using std::memory_order_consume; +using std::memory_order_relaxed; +using std::memory_order_release; +using std::memory_order_seq_cst; + +using std::kill_dependency; + +// [atomics.ref.generic], class template atomic_ref +// [atomics.ref.pointer], partial specialization for pointers +using std::atomic_ref; + +// [atomics.types.generic], class template atomic +// [atomics.ref.pointer], partial specialization for pointers +using std::atomic; + +// [atomics.nonmembers], non-member functions +using std::atomic_is_lock_free; +using std::atomic_store; +using std::atomic_store_explicit; +using std::atomic_load; +using std::atomic_load_explicit; +using std::atomic_exchange; +using std::atomic_exchange_explicit; +using std::atomic_compare_exchange_weak; +using std::atomic_compare_exchange_strong; +using std::atomic_compare_exchange_weak_explicit; +using std::atomic_compare_exchange_strong_explicit; + +using std::atomic_fetch_add; +using std::atomic_fetch_add_explicit; +using std::atomic_fetch_sub; +using std::atomic_fetch_sub_explicit; +using std::atomic_fetch_and; +using std::atomic_fetch_and_explicit; +using std::atomic_fetch_or; +using std::atomic_fetch_or_explicit; +using std::atomic_fetch_xor; +using std::atomic_fetch_xor_explicit; +using std::atomic_wait; +using std::atomic_wait_explicit; +using std::atomic_notify_one; +using std::atomic_notify_all; + +// [atomics.nonmembers], non-member functions +// [atomics.alias], type aliases +using std::atomic_bool; +using std::atomic_char; +using std::atomic_schar; +using std::atomic_uchar; +using std::atomic_short; +using std::atomic_ushort; +using std::atomic_int; +using std::atomic_uint; +using std::atomic_long; +using std::atomic_ulong; +using std::atomic_llong; +using std::atomic_ullong; +using std::atomic_char8_t; +using std::atomic_char16_t; +using std::atomic_char32_t; +using std::atomic_wchar_t; + +using std::atomic_int8_t; +using std::atomic_uint8_t; +using std::atomic_int16_t; +using std::atomic_uint16_t; +using std::atomic_int32_t; +using std::atomic_uint32_t; +using std::atomic_int64_t; +using std::atomic_uint64_t; + +using std::atomic_int_least8_t; +using std::atomic_uint_least8_t; +using std::atomic_int_least16_t; +using std::atomic_uint_least16_t; +using std::atomic_int_least32_t; +using std::atomic_uint_least32_t; +using std::atomic_int_least64_t; +using std::atomic_uint_least64_t; + +using std::atomic_int_fast8_t; +using std::atomic_uint_fast8_t; +using std::atomic_int_fast16_t; +using std::atomic_uint_fast16_t; +using std::atomic_int_fast32_t; +using std::atomic_uint_fast32_t; +using std::atomic_int_fast64_t; +using std::atomic_uint_fast64_t; + +using std::atomic_intptr_t; +using std::atomic_uintptr_t; +using std::atomic_size_t; +using std::atomic_ptrdiff_t; +using std::atomic_intmax_t; +using std::atomic_uintmax_t; + +using std::atomic_signed_lock_free; +using std::atomic_unsigned_lock_free; + +// [atomics.flag], flag type and operations +using std::atomic_flag; + +using std::atomic_flag_test; +using std::atomic_flag_test_explicit; +using std::atomic_flag_test_and_set; +using std::atomic_flag_test_and_set_explicit; +using std::atomic_flag_clear; +using std::atomic_flag_clear_explicit; +using std::atomic_flag_wait; +using std::atomic_flag_wait_explicit; +using std::atomic_flag_notify_one; +using std::atomic_flag_notify_all; + +// [atomics.fences], fences +using std::atomic_thread_fence; +using std::atomic_signal_fence; + +// [depr.atomics.nonmembers] +using std::atomic_init; + +} // namespace std diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index 4e4fd7d6..6552c4fa 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -4,6 +4,7 @@ module; #include #include #include +#include #include #include #include @@ -20,6 +21,7 @@ export module std; #include "algorithm.hpp" #include "any.hpp" #include "array.hpp" +#include "atomic.hpp" #include "bit.hpp" #include "cstdint.hpp" #include "concepts.hpp" From 680f504d550847d91c44d761200ac34eebd4feef Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Thu, 18 Apr 2024 21:50:50 +0100 Subject: [PATCH 09/14] Modularise further threading primitives --- modules/std/std/algorithm.hpp | 3 +- modules/std/std/any.hpp | 3 +- modules/std/std/array.hpp | 3 +- modules/std/std/atomic.hpp | 3 +- modules/std/std/barrier.hpp | 12 +++++ modules/std/std/bit.hpp | 3 +- modules/std/std/bitset.hpp | 15 ++++++ modules/std/std/cctype.hpp | 21 ++++++++ modules/std/std/compare.hpp | 71 ++++++++++++++++++++++++++ modules/std/std/concepts.hpp | 3 +- modules/std/std/condition_variable.hpp | 17 ++++++ modules/std/std/cstdint.hpp | 3 +- modules/std/std/deque.hpp | 23 +++++++++ modules/std/std/functional.hpp | 3 +- modules/std/std/future.hpp | 43 ++++++++++++++++ modules/std/std/hazard_pointer.hpp | 16 ++++++ modules/std/std/latch.hpp | 8 +++ modules/std/std/list.hpp | 23 +++++++++ modules/std/std/map.hpp | 34 ++++++++++++ modules/std/std/mutex.hpp | 41 +++++++++++++++ modules/std/std/rcu.hpp | 18 +++++++ modules/std/std/semaphore.hpp | 15 ++++++ modules/std/std/set.hpp | 34 ++++++++++++ modules/std/std/shared_mutex.hpp | 16 ++++++ modules/std/std/source_location.hpp | 2 + modules/std/std/stacktrace.hpp | 2 + modules/std/std/std.ixx | 40 +++++++++++++++ modules/std/std/stop_token.hpp | 19 +++++++ modules/std/std/string.hpp | 3 +- modules/std/std/string_view.hpp | 3 +- modules/std/std/thread.hpp | 3 +- modules/std/std/type_traits.hpp | 3 +- modules/std/std/vector.hpp | 3 +- 33 files changed, 496 insertions(+), 13 deletions(-) create mode 100644 modules/std/std/barrier.hpp create mode 100644 modules/std/std/bitset.hpp create mode 100644 modules/std/std/cctype.hpp create mode 100644 modules/std/std/compare.hpp create mode 100644 modules/std/std/condition_variable.hpp create mode 100644 modules/std/std/deque.hpp create mode 100644 modules/std/std/future.hpp create mode 100644 modules/std/std/hazard_pointer.hpp create mode 100644 modules/std/std/latch.hpp create mode 100644 modules/std/std/list.hpp create mode 100644 modules/std/std/map.hpp create mode 100644 modules/std/std/mutex.hpp create mode 100644 modules/std/std/rcu.hpp create mode 100644 modules/std/std/semaphore.hpp create mode 100644 modules/std/std/set.hpp create mode 100644 modules/std/std/shared_mutex.hpp create mode 100644 modules/std/std/stop_token.hpp diff --git a/modules/std/std/algorithm.hpp b/modules/std/std/algorithm.hpp index ec70761a..26ec99fb 100644 --- a/modules/std/std/algorithm.hpp +++ b/modules/std/std/algorithm.hpp @@ -1,4 +1,5 @@ -/// \algorithm.hpp Modularisation for https://eel.is/c++draft/algorithm.syn +/// \file algorithm.hpp +/// Modularisation for https://eel.is/c++draft/algorithm.syn export namespace std { diff --git a/modules/std/std/any.hpp b/modules/std/std/any.hpp index a02facb0..1923ee35 100644 --- a/modules/std/std/any.hpp +++ b/modules/std/std/any.hpp @@ -1,4 +1,5 @@ -/// \any.hpp Modularisation for https://eel.is/c++draft/any.synop +/// \file any.hpp +/// Modularisation for https://eel.is/c++draft/any.synop export namespace std { diff --git a/modules/std/std/array.hpp b/modules/std/std/array.hpp index 05b8f722..5fc9af3e 100644 --- a/modules/std/std/array.hpp +++ b/modules/std/std/array.hpp @@ -1,4 +1,5 @@ -// \array.hpp Modularisation for https://eel.is/c++draft/array.syn +/// \file array.hpp +/// Modularisation for https://eel.is/c++draft/array.syn export namespace std { diff --git a/modules/std/std/atomic.hpp b/modules/std/std/atomic.hpp index 2e3ba9df..0f586833 100644 --- a/modules/std/std/atomic.hpp +++ b/modules/std/std/atomic.hpp @@ -1,4 +1,5 @@ -// \atomic.hpp Modularisation for https://eel.is/c++draft/atomics.syn +/// \file atomic.hpp +/// Modularisation for https://eel.is/c++draft/atomics.syn export namespace std { diff --git a/modules/std/std/barrier.hpp b/modules/std/std/barrier.hpp new file mode 100644 index 00000000..e4e4ef1f --- /dev/null +++ b/modules/std/std/barrier.hpp @@ -0,0 +1,12 @@ +/// \file barrier.hpp +/// Modularisation for https://eel.is/c++draft/barrier.syn +export namespace std +{ + +#if (__cpp_lib_barrier >= 201907L) + + using std::barrier; + +#endif // #if (__cpp_lib_barrier >= 201907L) + +} // namespace std diff --git a/modules/std/std/bit.hpp b/modules/std/std/bit.hpp index 62d8ac01..7585ed0d 100644 --- a/modules/std/std/bit.hpp +++ b/modules/std/std/bit.hpp @@ -1,4 +1,5 @@ -// \bit.hpp Modularisation for https://eel.is/c++draft/bit.syn +/// \file bit.hpp +/// Modularisation for https://eel.is/c++draft/bit.syn export namespace std { diff --git a/modules/std/std/bitset.hpp b/modules/std/std/bitset.hpp new file mode 100644 index 00000000..0afa7708 --- /dev/null +++ b/modules/std/std/bitset.hpp @@ -0,0 +1,15 @@ +/// \file bitset.hpp +/// Modularisation for https://eel.is/c++draft/bitset.syn +export namespace std +{ + +using std::bitset; + +// [bitset.operators], bitset operators +using std::operator&; +using std::operator|; +using std::operator^; +using std::operator>>; +using std::operator<<; + +} // namespace std diff --git a/modules/std/std/cctype.hpp b/modules/std/std/cctype.hpp new file mode 100644 index 00000000..3e9655a3 --- /dev/null +++ b/modules/std/std/cctype.hpp @@ -0,0 +1,21 @@ +/// \file cctype.hpp +/// Modularisation for https://eel.is/c++draft/cctype.syn +export namespace std +{ + +using std::isalnum; +using std::isalpha; +using std::isblank; +using std::iscntrl; +using std::isdigit; +using std::isgraph; +using std::islower; +using std::isprint; +using std::ispunct; +using std::isspace; +using std::isupper; +using std::isxdigit; +using std::tolower; +using std::toupper; + +} // namespace std diff --git a/modules/std/std/compare.hpp b/modules/std/std/compare.hpp new file mode 100644 index 00000000..2b67d779 --- /dev/null +++ b/modules/std/std/compare.hpp @@ -0,0 +1,71 @@ +/// \file compare.hpp +/// Modularisation for https://eel.is/c++draft/compare.syn +export namespace std +{ + +// [cmp.categories], comparison category types +using std::partial_ordering; +using std::weak_ordering; +using std::strong_ordering; + +// named comparison functions +using std::is_eq; +using std::is_neq; +using std::is_lt; +using std::is_lteq; +using std::is_gt; +using std::is_gteq; + +// [cmp.common], common comparison category type +using std::common_comparison_category; +using std::common_comparison_category_t; + +// [cmp.concept], concept three_way_comparable +using std::three_way_comparable; +using std::three_way_comparable_with; + +// [cmp.result], result of three-way comparison +using std::compare_three_way_result; +using std::compare_three_way_result_t; + +// [comparisons.three.way], class compare_three_way +using std::compare_three_way; + +// [cmp.alg], comparison algorithms +using std::compare_three_way; + +// [cmp.alg], comparison algorithms +/* +inline namespace __cpo +{ + using std::__cpo::strong_order; + using std::__cpo::weak_order; + using std::__cpo::partial_order; + using std::__cpo::compare_strong_order_fallback; + using std::__cpo::compare_weak_order_fallback; + using std::__cpo::compare_partial_order_fallback; +} // namespace __cpo +*/ + +} // namespace std + + +/* +// all freestanding +namespace std { + + // [comparisons.three.way], class compare_three_way + struct compare_three_way; + + // [cmp.alg], comparison algorithms + inline namespace unspecified { + inline constexpr unspecified strong_order = unspecified; + inline constexpr unspecified weak_order = unspecified; + inline constexpr unspecified partial_order = unspecified; + inline constexpr unspecified compare_strong_order_fallback = unspecified; + inline constexpr unspecified compare_weak_order_fallback = unspecified; + inline constexpr unspecified compare_partial_order_fallback = unspecified; + } +} + +*/ diff --git a/modules/std/std/concepts.hpp b/modules/std/std/concepts.hpp index 3d9c7947..91c898e4 100644 --- a/modules/std/std/concepts.hpp +++ b/modules/std/std/concepts.hpp @@ -1,4 +1,5 @@ -// \concepts.hpp Modularisation for https://eel.is/c++draft/concepts.syn +/// \file +/// concepts.hpp Modularisation for https://eel.is/c++draft/concepts.syn export namespace std { // [concepts.lang], language-related concepts diff --git a/modules/std/std/condition_variable.hpp b/modules/std/std/condition_variable.hpp new file mode 100644 index 00000000..fa858242 --- /dev/null +++ b/modules/std/std/condition_variable.hpp @@ -0,0 +1,17 @@ +/// \file condition_variable.hpp +/// Modularisation for https://eel.is/c++draft/condition.variable.syn +export namespace std +{ + +// [thread.condition.condvar], class condition_variable +using std::condition_variable; + +// [thread.condition.condvarany], class condition_variable_any +using std::condition_variable_any; + +// [thread.condition.nonmember], non-member functions +using std::notify_all_at_thread_exit; + +using std::cv_status; + +} // namespace std diff --git a/modules/std/std/cstdint.hpp b/modules/std/std/cstdint.hpp index 2214e9d7..87af21f9 100644 --- a/modules/std/std/cstdint.hpp +++ b/modules/std/std/cstdint.hpp @@ -1,4 +1,5 @@ -// \cstdint.hpp Modularisation for https://eel.is/c++draft/cstdint.syn +/// \file cstdint.hpp +/// Modularisation for https://eel.is/c++draft/cstdint.syn export namespace std { using std::int8_t; diff --git a/modules/std/std/deque.hpp b/modules/std/std/deque.hpp new file mode 100644 index 00000000..ff8334bf --- /dev/null +++ b/modules/std/std/deque.hpp @@ -0,0 +1,23 @@ +/// \file deque.hpp +/// Modularisation for https://eel.is/c++draft/deque.syn +export namespace std +{ + +// [deque], class template deque +using std::deque; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [deque.erasure], erasure +using std::erase; +using std::erase_if; + +namespace pmr +{ + using std::pmr::deque; +} + +} // namespace std diff --git a/modules/std/std/functional.hpp b/modules/std/std/functional.hpp index 8d064e1e..c619cec9 100644 --- a/modules/std/std/functional.hpp +++ b/modules/std/std/functional.hpp @@ -1,4 +1,5 @@ -/// https://en.cppreference.com/w/cpp/header/functional +/// \file functional.hpp +/// Modularisation for https://eel.is/c++draft/functional.syn export namespace std { diff --git a/modules/std/std/future.hpp b/modules/std/std/future.hpp new file mode 100644 index 00000000..d657abce --- /dev/null +++ b/modules/std/std/future.hpp @@ -0,0 +1,43 @@ +/// \file future.hpp +/// Modularisation for https://eel.is/c++draft/future.syn +export namespace std +{ + +using std::future_errc; + +using std::launch; + +using std::future_status; + +// [futures.errors], error handling +using std::is_error_code_enum; +using std::make_error_code; +using std::make_error_condition; + +using std::future_category; + +// [futures.future.error], class future_error +using std::future_error; + +// [futures.promise], class template promise +using std::promise; + +using std::swap; + +using std::uses_allocator; + +// [futures.unique.future], class template future +using std::future; + +// [futures.shared.future], class template shared_future +using std::shared_future; + +// [futures.task], class template packaged_task +using std::packaged_task; + +using std::swap; + +// [futures.async], function template async +using std::async; + +} // namespace std diff --git a/modules/std/std/hazard_pointer.hpp b/modules/std/std/hazard_pointer.hpp new file mode 100644 index 00000000..976d0126 --- /dev/null +++ b/modules/std/std/hazard_pointer.hpp @@ -0,0 +1,16 @@ +/// \file hazard_pointer.hpp +/// Modularisation for https://eel.is/c++draft/hazard.pointer.syn +export namespace std +{ + +// [saferecl.hp.base], class template hazard_pointer_obj_base +using std::hazard_pointer_obj_base; + +// [saferecl.hp.holder], class hazard_pointer +using std::hazard_pointer; + +// [saferecl.hp.holder.nonmem], non-member functions +using std::make_hazard_pointer; +using std::swap; + +} // namespace std diff --git a/modules/std/std/latch.hpp b/modules/std/std/latch.hpp new file mode 100644 index 00000000..5ff15087 --- /dev/null +++ b/modules/std/std/latch.hpp @@ -0,0 +1,8 @@ +/// \file latch.hpp +/// Modularisation for https://eel.is/c++draft/latch.syn +export namespace std +{ + +using std::latch; + +} // namespace std diff --git a/modules/std/std/list.hpp b/modules/std/std/list.hpp new file mode 100644 index 00000000..6f3df343 --- /dev/null +++ b/modules/std/std/list.hpp @@ -0,0 +1,23 @@ +/// \file list.hpp +/// Modularisation for https://eel.is/c++draft/list.syn +export namespace std +{ + +// [list], class template list +using std::list; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [list.erasure], erasure +using std::erase; +using std::erase_if; + +namespace pmr +{ +using std::pmr::list; +} // namespace pmr + +} // namespace std diff --git a/modules/std/std/map.hpp b/modules/std/std/map.hpp new file mode 100644 index 00000000..4635b3c9 --- /dev/null +++ b/modules/std/std/map.hpp @@ -0,0 +1,34 @@ +/// \file map.hpp +/// Modularisation for https://eel.is/c++draft/associative.map.syn +export namespace std +{ + +// [map], class template map +using std::map; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [map.erasure], erasure for map +using std::erase_if; + +// [multimap], class template multimap +using std::multimap; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [multimap.erasure], erasure for map +using std::erase_if; + +namespace pmr +{ +using std::pmr::map; +using std::pmr::multimap; +} // namespace pmr + +} // namespace std diff --git a/modules/std/std/mutex.hpp b/modules/std/std/mutex.hpp new file mode 100644 index 00000000..d3c3a372 --- /dev/null +++ b/modules/std/std/mutex.hpp @@ -0,0 +1,41 @@ +/// \file mutex.hpp +/// Modularisation for https://eel.is/c++draft/mutex.syn +export namespace std +{ + +// [thread.mutex.class], class mutex +using std::mutex; + +// [thread.mutex.recursive], class recursive_mutex +using std::recursive_mutex; + +// [thread.timedmutex.class] class timed_mutex +using std::timed_mutex; + +// [thread.timedmutex.recursive], class recursive_timed_mutex +using std::recursive_timed_mutex; + +using std::defer_lock_t; +using std::try_to_lock_t; +using std::adopt_lock_t; + +using std::defer_lock; +using std::try_to_lock; +using std::adopt_lock; + +// [thread.lock], locks +using std::lock_guard; +using std::scoped_lock; +using std::unique_lock; + +using std::swap; + +// [thread.lock.algorithm], generic locking algorithms +using std::try_lock; +using std::lock; + +using std::once_flag; + +using std::call_once; + +} // namespace std diff --git a/modules/std/std/rcu.hpp b/modules/std/std/rcu.hpp new file mode 100644 index 00000000..bcce072a --- /dev/null +++ b/modules/std/std/rcu.hpp @@ -0,0 +1,18 @@ +/// \file rcu.hpp +/// Modularisation for https://eel.is/c++draft/rcu.syn +export namespace std +{ + +// [saferecl.rcu.base], class template rcu_obj_base +using std::rcu_obj_base; + +// [saferecl.rcu.domain], class rcu_domain +using std::rcu_domain; + +// [saferecl.rcu.domain.func] non-member functions +using std::rcu_default_domain; +using std::rcu_synchronize; +using std::rcu_barrier; +using std::rcu_retire; + +} // namespace std diff --git a/modules/std/std/semaphore.hpp b/modules/std/std/semaphore.hpp new file mode 100644 index 00000000..120d3d23 --- /dev/null +++ b/modules/std/std/semaphore.hpp @@ -0,0 +1,15 @@ +/// \file semaphore.hpp +/// Modularisation for https://eel.is/c++draft/semaphore.syn +export namespace std +{ + +#if (__cpp_lib_semaphore >= 201907L) + + // [thread.sema.cnt], class template counting_semaphore + using std::counting_semaphore; + + using std::binary_semaphore; + +#endif // #if (__cpp_lib_semaphore >= 201907L) + +} // namespace std diff --git a/modules/std/std/set.hpp b/modules/std/std/set.hpp new file mode 100644 index 00000000..1d4e87ef --- /dev/null +++ b/modules/std/std/set.hpp @@ -0,0 +1,34 @@ +/// \file set.hpp +/// Modularisation for https://eel.is/c++draft/associative.set.syn +export namespace std +{ + +// [set], class template map +using std::set; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [set.erasure], erasure for set +using std::erase_if; + +// [multiset], class template multiset +using std::multiset; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [multiset.erasure], erasure for set +using std::erase_if; + +namespace pmr +{ +using std::pmr::set; +using std::pmr::multiset; +} // namespace pmr + +} // namespace std diff --git a/modules/std/std/shared_mutex.hpp b/modules/std/std/shared_mutex.hpp new file mode 100644 index 00000000..26c804c4 --- /dev/null +++ b/modules/std/std/shared_mutex.hpp @@ -0,0 +1,16 @@ +/// \file shared_mutex.hpp +/// Modularisation for https://eel.is/c++draft/shared.mutex.syn +export namespace std +{ + +// [thread.sharedmutex.class], class shared_mutex +using std::shared_mutex; + +// [thread.sharedtimedmutex.class], class shared_timed_mutex +using std::shared_timed_mutex; + +// [thread.lock.shared], class template shared_lock +using std::shared_lock; +using std::swap; + +} // namespace std diff --git a/modules/std/std/source_location.hpp b/modules/std/std/source_location.hpp index 0e27544b..1a703c69 100644 --- a/modules/std/std/source_location.hpp +++ b/modules/std/std/source_location.hpp @@ -1,3 +1,5 @@ +/// \file source_location.hpp +/// Modularisation for https://eel.is/c++draft/source.location.syn export namespace std { diff --git a/modules/std/std/stacktrace.hpp b/modules/std/std/stacktrace.hpp index 3d8202d7..5db72e2a 100644 --- a/modules/std/std/stacktrace.hpp +++ b/modules/std/std/stacktrace.hpp @@ -1,3 +1,5 @@ +/// \file stacktrace.hpp +/// Modularisation for https://eel.is/c++draft/stacktrace.syn export namespace std { diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index 6552c4fa..f0f10449 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -5,12 +5,32 @@ module; #include #include #include +#include #include +#include +#include #include +#include #include +#include +#include #include +#if __has_include() + #include +#endif +#include +#include +#include +#include +#if __has_include() + #include +#endif +#include +#include +#include #include #include +#include #include #include #include @@ -22,13 +42,33 @@ export module std; #include "any.hpp" #include "array.hpp" #include "atomic.hpp" +#include "barrier.hpp" #include "bit.hpp" +#include "bitset.hpp" +#include "cctype.hpp" #include "cstdint.hpp" #include "concepts.hpp" +#include "compare.hpp" +#include "condition_variable.hpp" +#include "deque.hpp" +#if __has_include() + #include "hazard_pointer.hpp" +#endif #include "functional.hpp" +#include "future.hpp" +#include "latch.hpp" +#include "map.hpp" +#include "mutex.hpp" +#if __has_include() + #include "rcu.hpp" +#endif +#include "semaphore.hpp" +#include "set.hpp" +#include "shared_mutex.hpp" #include "string.hpp" #include "source_location.hpp" #include "stacktrace.hpp" +#include "stop_token.hpp" #include "string_view.hpp" #include "type_traits.hpp" #include "vector.hpp" diff --git a/modules/std/std/stop_token.hpp b/modules/std/std/stop_token.hpp new file mode 100644 index 00000000..23b6f530 --- /dev/null +++ b/modules/std/std/stop_token.hpp @@ -0,0 +1,19 @@ +/// \file stoptoken.hpp +/// Modularisation for https://eel.is/c++draft/thread.stoptoken.syn +export namespace std +{ + +// [stoptoken], class stop_token +using std::stop_token; + +// [stopsource], class stop_source +using std::stop_source; + +// no-shared-stop-state indicator +using std::nostopstate_t; +using std::nostopstate; + +// [stopcallback], class template stop_callback +using std::stop_callback; + +} // namespace std diff --git a/modules/std/std/string.hpp b/modules/std/std/string.hpp index 5704a5a7..dfe117bb 100644 --- a/modules/std/std/string.hpp +++ b/modules/std/std/string.hpp @@ -1,4 +1,5 @@ -/// \string.hpp Modularisation for https://eel.is/c++draft/string.syn +/// \file string.hpp +/// Modularisation for https://eel.is/c++draft/string.syn export namespace std { diff --git a/modules/std/std/string_view.hpp b/modules/std/std/string_view.hpp index 2d8891c2..9b2cb7ef 100644 --- a/modules/std/std/string_view.hpp +++ b/modules/std/std/string_view.hpp @@ -1,4 +1,5 @@ -/// \string_view.hpp Modularisation for https://eel.is/c++draft/string_view.syn +/// \file string_view.hpp +/// Modularisation for https://eel.is/c++draft/string_view.syn export namespace std { diff --git a/modules/std/std/thread.hpp b/modules/std/std/thread.hpp index c7d7065a..37a1ebff 100644 --- a/modules/std/std/thread.hpp +++ b/modules/std/std/thread.hpp @@ -1,4 +1,5 @@ -/// \thread.hpp Modularisation for https://eel.is/c++draft/thread.syn +/// \file thread.hpp +/// Modularisation for https://eel.is/c++draft/thread.syn export namespace std { diff --git a/modules/std/std/type_traits.hpp b/modules/std/std/type_traits.hpp index 97c487b0..3383af1a 100644 --- a/modules/std/std/type_traits.hpp +++ b/modules/std/std/type_traits.hpp @@ -1,4 +1,5 @@ -/// \type_traits.hpp Modularisation for https://eel.is/c++draft/meta.type.synop +/// \file type_traits.hpp +/// Modularisation for https://eel.is/c++draft/meta.type.synop export namespace std { diff --git a/modules/std/std/vector.hpp b/modules/std/std/vector.hpp index 0c60790f..80217901 100644 --- a/modules/std/std/vector.hpp +++ b/modules/std/std/vector.hpp @@ -1,4 +1,5 @@ -/// \vector.hpp Modularisation for https://eel.is/c++draft/vector.syn +/// \file vector.hpp +/// Modularisation for https://eel.is/c++draft/vector.syn export namespace std { From 5922fc00e8bfee0d98a5b28520962f0d300b55f5 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sun, 21 Apr 2024 13:24:57 +0100 Subject: [PATCH 10/14] d to f headers modularised --- modules/std/std/charconv.hpp | 17 ++++++ modules/std/std/cstddef.hpp | 33 +++++++++++ modules/std/std/debugging.hpp | 11 ++++ modules/std/std/exception.hpp | 26 +++++++++ modules/std/std/execution.hpp | 33 +++++++++++ modules/std/std/expected.hpp | 21 +++++++ modules/std/std/filesystem.hpp | 98 ++++++++++++++++++++++++++++++++ modules/std/std/flat_map.hpp | 28 +++++++++ modules/std/std/flat_set.hpp | 28 +++++++++ modules/std/std/format.hpp | 68 ++++++++++++++++++++++ modules/std/std/forward_list.hpp | 26 +++++++++ modules/std/std/fstream.hpp | 34 +++++++++++ modules/std/std/std.ixx | 48 +++++++++++++++- 13 files changed, 468 insertions(+), 3 deletions(-) create mode 100644 modules/std/std/charconv.hpp create mode 100644 modules/std/std/cstddef.hpp create mode 100644 modules/std/std/debugging.hpp create mode 100644 modules/std/std/exception.hpp create mode 100644 modules/std/std/execution.hpp create mode 100644 modules/std/std/expected.hpp create mode 100644 modules/std/std/filesystem.hpp create mode 100644 modules/std/std/flat_map.hpp create mode 100644 modules/std/std/flat_set.hpp create mode 100644 modules/std/std/format.hpp create mode 100644 modules/std/std/forward_list.hpp create mode 100644 modules/std/std/fstream.hpp diff --git a/modules/std/std/charconv.hpp b/modules/std/std/charconv.hpp new file mode 100644 index 00000000..4f9d2f1a --- /dev/null +++ b/modules/std/std/charconv.hpp @@ -0,0 +1,17 @@ +/// \file charconv.hpp +/// Modularisation for https://eel.is/c++draft/charconv.syn +export namespace std +{ + +// floating-point format for primitive numerical conversion +using std::chars_format; + +// [charconv.to.chars], primitive numerical output conversion +using std::to_chars_result; +using std::to_chars; + +// [charconv.from.chars], primitive numerical input conversion +using std::from_chars_result; +using std::from_chars; + +} // namespace std diff --git a/modules/std/std/cstddef.hpp b/modules/std/std/cstddef.hpp new file mode 100644 index 00000000..40e3ec7a --- /dev/null +++ b/modules/std/std/cstddef.hpp @@ -0,0 +1,33 @@ +/// \file cstddef.hpp +/// Modularisation for https://eel.is/c++draft/cstddef.syn + + +/* +namespace std { + using ptrdiff_t = see below; + using size_t = see below; + using max_align_t = see below; + using nullptr_t = decltype(nullptr); + + enum class byte : unsigned char {}; + + // [support.types.byteops], byte type operations + template + constexpr byte& operator<<=(byte& b, IntType shift) noexcept; + template + constexpr byte operator<<(byte b, IntType shift) noexcept; + template + constexpr byte& operator>>=(byte& b, IntType shift) noexcept; + template + constexpr byte operator>>(byte b, IntType shift) noexcept; + constexpr byte& operator|=(byte& l, byte r) noexcept; + constexpr byte operator|(byte l, byte r) noexcept; + constexpr byte& operator&=(byte& l, byte r) noexcept; + constexpr byte operator&(byte l, byte r) noexcept; + constexpr byte& operator^=(byte& l, byte r) noexcept; + constexpr byte operator^(byte l, byte r) noexcept; + constexpr byte operator~(byte b) noexcept; + template + constexpr IntType to_integer(byte b) noexcept; +} +*/ diff --git a/modules/std/std/debugging.hpp b/modules/std/std/debugging.hpp new file mode 100644 index 00000000..19b0ed44 --- /dev/null +++ b/modules/std/std/debugging.hpp @@ -0,0 +1,11 @@ +/// \file debugging.hpp +/// Modularisation for https://eel.is/c++draft/debugging.syn +export namespace std +{ + +// [debugging.utility], utility +using std::breakpoint; +using std::breakpoint_if_debugging; +using std::is_debugger_present; + +} // namespace std diff --git a/modules/std/std/exception.hpp b/modules/std/std/exception.hpp new file mode 100644 index 00000000..b8edf972 --- /dev/null +++ b/modules/std/std/exception.hpp @@ -0,0 +1,26 @@ +/// \file exception.hpp +/// Modularisation for https://eel.is/c++draft/exception.syn +export namespace std +{ + +using std::exception; +using std::bad_exception; +using std::nested_exception; + +using std::terminate_handler; +using std::get_terminate; +using std::set_terminate; +using std::terminate; + +using std::uncaught_exceptions; + +using std::exception_ptr; + +using std::current_exception; +using std::rethrow_exception; +using std::make_exception_ptr; + +using std::throw_with_nested; +using std::rethrow_if_nested; + +} // namespace std diff --git a/modules/std/std/execution.hpp b/modules/std/std/execution.hpp new file mode 100644 index 00000000..00029deb --- /dev/null +++ b/modules/std/std/execution.hpp @@ -0,0 +1,33 @@ +/// \file execution.hpp +/// Modularisation for https://eel.is/c++draft/execution.syn +export namespace std +{ + +// [execpol.type], execution policy type trait +using std::is_execution_policy; +using std::is_execution_policy_v; + +namespace execution +{ +// [execpol.seq], sequenced execution policy +using std::execution::sequenced_policy; + +// [execpol.par], parallel execution policy +using std::execution::parallel_policy; + +// [execpol.parunseq], parallel and unsequenced execution policy +using std::execution::parallel_unsequenced_policy; + +// [execpol.unseq], unsequenced execution policy +using std::execution::unsequenced_policy; + +// [execpol.objects], execution policy objects + +using std::execution::seq; +using std::execution::par; +using std::execution::par_unseq; +using std::execution::unseq; + +} + +} // namespace std diff --git a/modules/std/std/expected.hpp b/modules/std/std/expected.hpp new file mode 100644 index 00000000..8fad3398 --- /dev/null +++ b/modules/std/std/expected.hpp @@ -0,0 +1,21 @@ +/// \file expected.hpp +/// Modularisation for https://eel.is/c++draft/expected.syn +export namespace std +{ + +// [expected.unexpected], class template unexpected +using std::unexpected; + +// [expected.bad], class template bad_expected_access +// [expected.bad.void], specialization for void +using std::bad_expected_access; + +// in-place construction of unexpected values +using std::unexpect_t; +using std::unexpect; + +// [expected.expected], class template expected +// [expected.void], partial specialization of expected for void types +using std::expected; + +} // namespace std diff --git a/modules/std/std/filesystem.hpp b/modules/std/std/filesystem.hpp new file mode 100644 index 00000000..95911e7d --- /dev/null +++ b/modules/std/std/filesystem.hpp @@ -0,0 +1,98 @@ +/// \file filesystem.hpp +/// Modularisation for https://eel.is/c++draft/fs.filesystem.syn +export namespace std::filesystem +{ + +// [fs.class.path], paths +using std::filesystem::path; + +// [fs.path.nonmember], path non-member functions +using std::filesystem::swap; +using std::filesystem::hash_value; + +// [fs.class.filesystem.error], filesystem errors +using std::filesystem::filesystem_error; + +// [fs.class.directory.entry], directory entries +using std::filesystem::directory_entry; + +// [fs.class.directory.iterator], directory iterators +using std::filesystem::directory_iterator; + +// [fs.dir.itr.nonmembers], range access for directory iterators +using std::filesystem::begin; +using std::filesystem::end; + +// [fs.class.rec.dir.itr], recursive directory iterators +using std::filesystem::recursive_directory_iterator; + +// [fs.rec.dir.itr.nonmembers], range access for recursive directory iterators +using std::filesystem::begin; +using std::filesystem::end; + +// [fs.class.file.status], file status +using std::filesystem::file_status; + +using std::filesystem::space_info; + + // [fs.enum], enumerations +using std::filesystem::file_type; +using std::filesystem::perms; +using std::filesystem::perm_options; +using std::filesystem::copy_options; +using std::filesystem::directory_options; + +using std::filesystem::file_time_type; + +// [fs.op.funcs], filesystem operations +using std::filesystem::absolute; +using std::filesystem::canonical; +using std::filesystem::copy; +using std::filesystem::copy_file; +using std::filesystem::copy_symlink; +using std::filesystem::create_directories; +using std::filesystem::create_directory; +using std::filesystem::create_directory_symlink; +using std::filesystem::create_hard_link; +using std::filesystem::create_symlink; +using std::filesystem::current_path; +using std::filesystem::exists; +using std::filesystem::file_size; +using std::filesystem::hard_link_count; +using std::filesystem::is_block_file; +using std::filesystem::is_character_file; +using std::filesystem::is_directory; +using std::filesystem::is_empty; +using std::filesystem::is_fifo; +using std::filesystem::is_other; +using std::filesystem::is_regular_file; +using std::filesystem::is_socket; +using std::filesystem::is_symlink; +using std::filesystem::last_write_time; +using std::filesystem::permissions; +using std::filesystem::proximate; +using std::filesystem::read_symlink; +using std::filesystem::relative; +using std::filesystem::remove; +using std::filesystem::remove_all; +using std::filesystem::rename; +using std::filesystem::resize_file; +using std::filesystem::space; +using std::filesystem::status; +using std::filesystem::status_known; +using std::filesystem::symlink_status; +using std::filesystem::temp_directory_path; +using std::filesystem::weakly_canonical; + +} // namespace std + +export namespace std::filesystem +{ +using std::hash; +} + +export namespace std::ranges +{ +using std::ranges::enable_borrowed_range; +using std::ranges::enable_view; +} diff --git a/modules/std/std/flat_map.hpp b/modules/std/std/flat_map.hpp new file mode 100644 index 00000000..7b764c76 --- /dev/null +++ b/modules/std/std/flat_map.hpp @@ -0,0 +1,28 @@ +/// \file flat_map.hpp +/// Modularisation for https://eel.is/c++draft/flat.map.syn +export namespace std +{ + +// [flat.map], class template flat_map +using std::flat_map; + +using std::sorted_unique_t; +using std::sorted_unique; + +using std::uses_allocator; + +// [flat.map.erasure], erasure for flat_map +using std::erase_if; + +// [flat.multimap], class template flat_multimap +using std::flat_multimap; + +using std::sorted_equivalent_t; +using std::sorted_equivalent; + +using std::uses_allocator; + +// [flat.multimap.erasure], erasure for flat_multimap +using std::erase_if; + +} // namespace std diff --git a/modules/std/std/flat_set.hpp b/modules/std/std/flat_set.hpp new file mode 100644 index 00000000..37d5b2b3 --- /dev/null +++ b/modules/std/std/flat_set.hpp @@ -0,0 +1,28 @@ +/// \file flat_set.hpp +/// Modularisation for https://eel.is/c++draft/flat.set.syn +export namespace std +{ + +// [flat.set], class template flat_set +using std::flat_map; + +using std::sorted_unique; +using std::sorted_unique_t; + +using std::uses_allocator; + +// [flat.set.erasure], erasure for flat_set +using std::erase_if; + +// [flat.multiset], class template flat_multiset +using std::flat_multimap; + +using std::sorted_equivalent; +using std::sorted_equivalent_t; + +using std::uses_allocator; + +// [flat.multiset.erasure], erasure for flat_multiset +using std::erase_if; + +} // namespace std diff --git a/modules/std/std/format.hpp b/modules/std/std/format.hpp new file mode 100644 index 00000000..dc4f8085 --- /dev/null +++ b/modules/std/std/format.hpp @@ -0,0 +1,68 @@ +/// \file format.hpp +/// Modularisation for https://eel.is/c++draft/format.syn +export namespace std +{ + +// [format.context], class template basic_format_context +using std::basic_format_context; +using std::format_context; +using std::wformat_context; + +// [format.args], class template basic_format_args +using std::basic_format_args; +using std::format_args; +using std::wformat_args; + +// [format.fmt.string], class template basic_format_string +using std::basic_format_string; +using std::format_string; +using std::wformat_string; +#if (__cpp_lib_format >= 202311L) + using std::runtime_format; +#endif // #if (__cpp_lib_format >= 202311L) + +// [format.functions], formatting functions +using std::format; +using std::vformat; +using std::format_to; +using std::vformat_to; + +using std::format_to_n_result; +using std::format_to_n_result; +using std::formatted_size; + +// [format.formatter], formatter +using std::formatter; + +#if (__cpp_lib_format_ranges >= 202207L) + // [format.formattable], concept formattable + using std::formattable; +#endif // #if (__cpp_lib_format_ranges >= 202207L) + +// [format.parse.ctx], class template basic_format_parse_context +using std::basic_format_parse_context; +using std::format_parse_context; +using std::wformat_parse_context; + +#if (__cpp_lib_format_ranges >= 202207L) + // [format.range], formatting of ranges + // [format.range.fmtkind], variable template format_kind + using std::format_kind; + using std::range_format; + + // [format.range.formatter], class template range_formatter + using std::range_formatter; +#endif // #if (__cpp_lib_format_ranges >= 202207L) + +// [format.arguments], arguments +// [format.arg], class template basic_format_arg +using std::basic_format_arg; +using std::visit_format_arg; // Deprecated in C++26 + +using std::make_format_args; +using std::make_wformat_args; + +// [format.error], class format_error +using std::format_error; + +} // namespace std diff --git a/modules/std/std/forward_list.hpp b/modules/std/std/forward_list.hpp new file mode 100644 index 00000000..0e47b3bd --- /dev/null +++ b/modules/std/std/forward_list.hpp @@ -0,0 +1,26 @@ +/// \file forward_list.hpp +/// Modularisation for https://eel.is/c++draft/forward.list.syn +export namespace std +{ + +// [forward.list], class template forward_list +using std::forward_list; + +using std::operator==; +using std::operator<=>; + +using std::swap; + +// [forward.list.erasure], erasure +using std::erase; +using std::erase_if; + +namespace pmr +{ + +using std::pmr::forward_list; + +} // namespace pmr + + +} // namespace std diff --git a/modules/std/std/fstream.hpp b/modules/std/std/fstream.hpp new file mode 100644 index 00000000..12ec340c --- /dev/null +++ b/modules/std/std/fstream.hpp @@ -0,0 +1,34 @@ +/// \file fstream.hpp +/// Modularisation for https://eel.is/c++draft/fstream.syn +export namespace std +{ + +using std::basic_filebuf; + +using std::swap; + +using std::filebuf; +using std::wfilebuf; + +using std::basic_ifstream; + +using std::swap; + +using std::ifstream; +using std::wifstream; + +using std::basic_ofstream; + +using std::swap; + +using std::ofstream; +using std::wofstream; + +using std::basic_fstream; + +using std::swap; + +using std::fstream; +using std::wfstream; + +} // namespace std diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index f0f10449..923a284f 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -9,16 +9,37 @@ module; #include #include #include +#include #include #include #include #include #include +#if __has_include() + #include +#endif +#include +#include +#if __has_include() + #include +#endif +#include +#if __has_include() + #include +#endif +#if __has_include() + #include +#endif +#if __has_include() + #include +#endif +#include +#include #include -#if __has_include() +#include +#if __has_include() #include #endif -#include #include #include #include @@ -46,14 +67,35 @@ export module std; #include "bit.hpp" #include "bitset.hpp" #include "cctype.hpp" +#include "charconv.hpp" #include "cstdint.hpp" #include "concepts.hpp" #include "compare.hpp" #include "condition_variable.hpp" #include "deque.hpp" -#if __has_include() +#if __has_include() + #include "debugging.hpp" +#endif +#include "exception.hpp" +#include "execution.hpp" +#if __has_include() + #include "expected.hpp" +#endif +#if __has_include() #include "hazard_pointer.hpp" #endif +#include "filesystem.hpp" +#if __has_include() + #include "flat_map.hpp" +#endif +#if __has_include() + #include "flat_set.hpp" +#endif +#if __has_include() + #include "format.hpp" +#endif +#include "forward_list.hpp" +#include "fstream.hpp" #include "functional.hpp" #include "future.hpp" #include "latch.hpp" From b67f44f429600ad8696c2e1d4700ad3ee2633471 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Tue, 23 Apr 2024 10:30:15 +0100 Subject: [PATCH 11/14] Update modules/CMakeLists.txt --- modules/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 33043bae..257031b8 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -2,6 +2,6 @@ if (${MORPHEUS_MODULES_SUPPORT}) set(CMAKE_CXX_SCAN_FOR_MODULES ON) - add_subdirectory(std) + add_subdirectory(std) endif (${MORPHEUS_MODULES_SUPPORT}) From 290369f00b5f8eae89d558a9fa1f60c86371da60 Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Thu, 25 Apr 2024 22:10:30 +0100 Subject: [PATCH 12/14] g to l headers modularised --- modules/std/std/generator.hpp | 15 +++++++ modules/std/std/initializer_list.hpp | 12 ++++++ modules/std/std/iomanip.hpp | 19 +++++++++ modules/std/std/ios.hpp | 59 ++++++++++++++++++++++++++ modules/std/std/locale.hpp | 63 ++++++++++++++++++++++++++++ modules/std/std/std.ixx | 22 ++++++++-- 6 files changed, 187 insertions(+), 3 deletions(-) create mode 100644 modules/std/std/generator.hpp create mode 100644 modules/std/std/initializer_list.hpp create mode 100644 modules/std/std/iomanip.hpp create mode 100644 modules/std/std/ios.hpp create mode 100644 modules/std/std/locale.hpp diff --git a/modules/std/std/generator.hpp b/modules/std/std/generator.hpp new file mode 100644 index 00000000..26ed3b60 --- /dev/null +++ b/modules/std/std/generator.hpp @@ -0,0 +1,15 @@ +/// \file generator.hpp +/// Modularisation for https://eel.is/c++draft/generator.syn +export namespace std +{ + +using std::generator; + +namespace pmr +{ + +using std::pmr::generator; + +} // namespace pmr + +} // namespace std diff --git a/modules/std/std/initializer_list.hpp b/modules/std/std/initializer_list.hpp new file mode 100644 index 00000000..5295bdb7 --- /dev/null +++ b/modules/std/std/initializer_list.hpp @@ -0,0 +1,12 @@ +/// \file initializer_list.hpp +/// Modularisation for https://eel.is/c++draft/initializer.list.syn +export namespace std +{ + +using std::initializer_list; + +// [support.initlist.range], initializer list range access +using std::begin; +using std::end; + +} // namespace std diff --git a/modules/std/std/iomanip.hpp b/modules/std/std/iomanip.hpp new file mode 100644 index 00000000..96ab59a1 --- /dev/null +++ b/modules/std/std/iomanip.hpp @@ -0,0 +1,19 @@ +/// \file iomanip.hpp +/// Modularisation for https://eel.is/c++draft/iomanip.syn +export namespace std +{ + +using std::resetiosflags; +using std::setiosflags; +using std::setbase; +using std::setfill; +using std::setprecision; +using std::setw; +using std::get_money; +using std::put_money; +using std::get_time; +using std::put_time; + +using std::quoted; + +} // namespace std diff --git a/modules/std/std/ios.hpp b/modules/std/std/ios.hpp new file mode 100644 index 00000000..de5d4ffc --- /dev/null +++ b/modules/std/std/ios.hpp @@ -0,0 +1,59 @@ +/// \file ios.hpp +/// Modularisation for https://eel.is/c++draft/ios.syn +export namespace std +{ + +using std::streamoff; +using std::streamsize; +using std::fpos; + +using std::ios_base; +using std::basic_ios; + +// [std.ios.manip], manipulators +using std::boolalpha; +using std::noboolalpha; + +using std::showbase; +using std::noshowbase; + +using std::showpoint; +using std::noshowpoint; + +using std::showpos; +using std::noshowpos; + +using std::skipws; +using std::noskipws; + +using std::uppercase; +using std::nouppercase; + +using std::unitbuf; +using std::nounitbuf; + +// [adjustfield.manip], adjustfield +using std::internal; +using std::left; +using std::right; + +// [basefield.manip], basefield +using std::dec; +using std::hex; +using std::oct; + +// [floatfield.manip], floatfield +using std::fixed; +using std::scientific; +using std::hexfloat; +using std::defaultfloat; + +// [error.reporting], error reporting +using std::io_errc; + +using std::is_error_code_enum; +using std::make_error_code; +using std::make_error_condition; +using std::iostream_category; + +} // namespace std diff --git a/modules/std/std/locale.hpp b/modules/std/std/locale.hpp new file mode 100644 index 00000000..02b27af3 --- /dev/null +++ b/modules/std/std/locale.hpp @@ -0,0 +1,63 @@ +/// \file locale.hpp +/// Modularisation for https://eel.is/c++draft/locale.syn +export namespace std +{ + +// [locale], locale +using std::locale; +using std::use_facet; +using std::has_facet; + +// [locale.convenience], convenience interfaces +using std::isspace; +using std::isprint; +using std::iscntrl; +using std::isupper; +using std::islower; +using std::isalpha; +using std::isdigit; +using std::ispunct; +using std::isxdigit; +using std::isalnum; +using std::isgraph; +using std::isblank; +using std::toupper; +using std::tolower; + +// [category.ctype], ctype +using std::ctype; +using std::ctype_byname; +using std::codecvt_base; +using std::codecvt; +using std::codecvt_byname; + +// [category.numeric], numeric +using std::num_get; +using std::num_put; +using std::numpunct; +using std::numpunct_byname; + +// [category.collate], collation +using std::collate; +using std::collate_byname; + +// [category.time], date and time +using std::time_base; +using std::time_get; +using std::time_get_byname; +using std::time_put; +using std::time_put_byname; + +// [category.monetary], money +using std::money_base; +using std::money_get; +using std::money_put; +using std::moneypunct; +using std::moneypunct_byname; + +// [category.messages], message retrieval +using std::messages_base; +using std::messages; +using std::messages_byname; + +} // namespace std diff --git a/modules/std/std/std.ixx b/modules/std/std/std.ixx index 923a284f..49749c3b 100644 --- a/modules/std/std/std.ixx +++ b/modules/std/std/std.ixx @@ -37,10 +37,18 @@ module; #include #include #include +#if __has_include() + #include +#endif #if __has_include() #include #endif +#include +#include +#include #include +#include +#include #include #include #if __has_include() @@ -81,9 +89,6 @@ export module std; #if __has_include() #include "expected.hpp" #endif -#if __has_include() - #include "hazard_pointer.hpp" -#endif #include "filesystem.hpp" #if __has_include() #include "flat_map.hpp" @@ -98,7 +103,18 @@ export module std; #include "fstream.hpp" #include "functional.hpp" #include "future.hpp" +#if __has_include() + #include "generator.hpp" +#endif +#if __has_include() + #include "hazard_pointer.hpp" +#endif +#include "initializer_list.hpp" +#include "iomanip.hpp" +#include "ios.hpp" #include "latch.hpp" +#include "list.hpp" +#include "locale.hpp" #include "map.hpp" #include "mutex.hpp" #if __has_include() From 076a327ad47032f76a71bdecaed4a764b017cb3d Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Fri, 26 Apr 2024 21:53:48 +0100 Subject: [PATCH 13/14] Work in progress modules usage --- libraries/core/src/morpheus/core/base/assert.hpp | 14 +++++++++----- .../core/src/morpheus/core/base/assert_handler.cpp | 14 ++++++++++++-- .../core/src/morpheus/core/base/assert_handler.hpp | 14 ++++++++++---- .../core/src/morpheus/core/base/debugging.cpp | 8 ++++++-- .../core/src/morpheus/core/base/debugging.hpp | 6 +++++- .../core/src/morpheus/core/base/exceptions.hpp | 2 +- libraries/core/src/morpheus/core/base/platform.hpp | 8 +++++++- .../core/src/morpheus/core/base/scoped_action.hpp | 9 +++++++-- .../core/src/morpheus/core/conformance/format.hpp | 10 +++++++--- .../morpheus/core/conformance/source_location.hpp | 10 +++++++--- .../src/morpheus/core/conformance/stacktrace.hpp | 10 +++++++--- .../core/conversion/adapters/std/stacktrace.hpp | 6 +++++- .../core/conversion/adapters/std/thread.hpp | 1 - libraries/core/testing/morpheus/catch2/main.cpp.in | 4 ++++ 14 files changed, 87 insertions(+), 29 deletions(-) diff --git a/libraries/core/src/morpheus/core/base/assert.hpp b/libraries/core/src/morpheus/core/base/assert.hpp index c33b4497..27191c82 100644 --- a/libraries/core/src/morpheus/core/base/assert.hpp +++ b/libraries/core/src/morpheus/core/base/assert.hpp @@ -1,14 +1,18 @@ #pragma once -#include +#include #include #include #include -#include -#include -#include -#include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include + #include + #include + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) namespace morpheus { diff --git a/libraries/core/src/morpheus/core/base/assert_handler.cpp b/libraries/core/src/morpheus/core/base/assert_handler.cpp index 7879f8c9..7a1e78f2 100644 --- a/libraries/core/src/morpheus/core/base/assert_handler.cpp +++ b/libraries/core/src/morpheus/core/base/assert_handler.cpp @@ -1,11 +1,21 @@ +#if (MORPHEUS_MODULES_SUPPORT) +// import std; +#endif // #if (MORPHEUS_MODULES_SUPPORT) + #include "morpheus/core/base/assert_handler.hpp" #include "morpheus/core/base/debugging.hpp" #include "morpheus/core/conformance/format.hpp" #include "morpheus/core/conformance/stacktrace.hpp" #include "morpheus/core/conversion/adapters/std/stacktrace.hpp" -#include -#include + +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include + #include + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) namespace morpheus { diff --git a/libraries/core/src/morpheus/core/base/assert_handler.hpp b/libraries/core/src/morpheus/core/base/assert_handler.hpp index cc9cad72..224226a4 100644 --- a/libraries/core/src/morpheus/core/base/assert_handler.hpp +++ b/libraries/core/src/morpheus/core/base/assert_handler.hpp @@ -1,12 +1,18 @@ #pragma once +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#endif // #if (MORPHEUS_MODULES_SUPPORT) + #include #include -#include -#include -#include -#include +//#if (!MORPHEUS_MODULES_SUPPORT) + #include + #include + #include + #include +//#endif // #if (!MORPHEUS_MODULES_SUPPORT) namespace morpheus { diff --git a/libraries/core/src/morpheus/core/base/debugging.cpp b/libraries/core/src/morpheus/core/base/debugging.cpp index 7f3abbc2..dbc3d44b 100644 --- a/libraries/core/src/morpheus/core/base/debugging.cpp +++ b/libraries/core/src/morpheus/core/base/debugging.cpp @@ -3,8 +3,12 @@ #include -#include -#include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) namespace morpheus { diff --git a/libraries/core/src/morpheus/core/base/debugging.hpp b/libraries/core/src/morpheus/core/base/debugging.hpp index b8d824a6..1817f0ea 100644 --- a/libraries/core/src/morpheus/core/base/debugging.hpp +++ b/libraries/core/src/morpheus/core/base/debugging.hpp @@ -3,7 +3,11 @@ #include #include -#include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) namespace morpheus { diff --git a/libraries/core/src/morpheus/core/base/exceptions.hpp b/libraries/core/src/morpheus/core/base/exceptions.hpp index 6bd37142..65494acc 100644 --- a/libraries/core/src/morpheus/core/base/exceptions.hpp +++ b/libraries/core/src/morpheus/core/base/exceptions.hpp @@ -15,7 +15,7 @@ namespace morpheus using ExceptionInfo = boost::error_info; -/// \group Exception Helpers +/// \defgroup Exception Helpers /// Throwing of exceptions is moved to explicitly outlined functions to ensure code density around exception sites. /// Additionally this allows to inform the compiler that exceptions are expected to be on the cold path to ensure /// optimal code generation where exceptions are thrown. diff --git a/libraries/core/src/morpheus/core/base/platform.hpp b/libraries/core/src/morpheus/core/base/platform.hpp index 1fab8cc3..42d1859e 100644 --- a/libraries/core/src/morpheus/core/base/platform.hpp +++ b/libraries/core/src/morpheus/core/base/platform.hpp @@ -1,9 +1,15 @@ #pragma once -#include #include #include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) + + /*! \defgroup Platform Morpheus Supported Platforms The platform group of macros allow for compile time detection of the current platform. @{ diff --git a/libraries/core/src/morpheus/core/base/scoped_action.hpp b/libraries/core/src/morpheus/core/base/scoped_action.hpp index f9289717..9df09712 100644 --- a/libraries/core/src/morpheus/core/base/scoped_action.hpp +++ b/libraries/core/src/morpheus/core/base/scoped_action.hpp @@ -1,7 +1,12 @@ #pragma once -#include -#include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) + namespace morpheus { diff --git a/libraries/core/src/morpheus/core/conformance/format.hpp b/libraries/core/src/morpheus/core/conformance/format.hpp index 66f018ee..05fe2248 100644 --- a/libraries/core/src/morpheus/core/conformance/format.hpp +++ b/libraries/core/src/morpheus/core/conformance/format.hpp @@ -2,9 +2,13 @@ #include -#if __has_include() - #include -#endif +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #if __has_include() + #include + #endif +//#endif // #if (MORPHEUS_MODULES_SUPPORT) // clang-format off #if (__cpp_lib_format >= 201907L) diff --git a/libraries/core/src/morpheus/core/conformance/source_location.hpp b/libraries/core/src/morpheus/core/conformance/source_location.hpp index d3f26863..df4c5a39 100644 --- a/libraries/core/src/morpheus/core/conformance/source_location.hpp +++ b/libraries/core/src/morpheus/core/conformance/source_location.hpp @@ -1,8 +1,12 @@ #pragma once -#if __has_include() - #include -#endif +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #if __has_include() + #include + #endif +//#endif // #if (MORPHEUS_MODULES_SUPPORT) // clang-format off #if (__cpp_lib_source_location >= 201907L) diff --git a/libraries/core/src/morpheus/core/conformance/stacktrace.hpp b/libraries/core/src/morpheus/core/conformance/stacktrace.hpp index 9e691515..2ebb1d5b 100644 --- a/libraries/core/src/morpheus/core/conformance/stacktrace.hpp +++ b/libraries/core/src/morpheus/core/conformance/stacktrace.hpp @@ -1,8 +1,12 @@ #pragma once -#if __has_include() - #include -#endif +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #if __has_include() + #include + #endif +//#endif // #if (MORPHEUS_MODULES_SUPPORT) // clang-format off #if (__cpp_lib_stacktrace >= 202011L) diff --git a/libraries/core/src/morpheus/core/conversion/adapters/std/stacktrace.hpp b/libraries/core/src/morpheus/core/conversion/adapters/std/stacktrace.hpp index b46b1b3a..714b4ce4 100644 --- a/libraries/core/src/morpheus/core/conversion/adapters/std/stacktrace.hpp +++ b/libraries/core/src/morpheus/core/conversion/adapters/std/stacktrace.hpp @@ -3,7 +3,11 @@ #include "morpheus/core/conformance/format.hpp" #include "morpheus/core/conformance/stacktrace.hpp" -#include +//#if (MORPHEUS_MODULES_SUPPORT) +// import std; +//#else + #include +//#endif // #if (MORPHEUS_MODULES_SUPPORT) // clang-format off #if (__cpp_lib_formatters < 202302L) diff --git a/libraries/core/src/morpheus/core/conversion/adapters/std/thread.hpp b/libraries/core/src/morpheus/core/conversion/adapters/std/thread.hpp index 8b143b82..bdeb9400 100644 --- a/libraries/core/src/morpheus/core/conversion/adapters/std/thread.hpp +++ b/libraries/core/src/morpheus/core/conversion/adapters/std/thread.hpp @@ -1,6 +1,5 @@ #pragma once -#include "morpheus/core/conformance/format.hpp" #include "morpheus/core/conformance/format.hpp" #include diff --git a/libraries/core/testing/morpheus/catch2/main.cpp.in b/libraries/core/testing/morpheus/catch2/main.cpp.in index 93688d07..2ec2b2ea 100644 --- a/libraries/core/testing/morpheus/catch2/main.cpp.in +++ b/libraries/core/testing/morpheus/catch2/main.cpp.in @@ -1,3 +1,7 @@ +#if (MORPHEUS_MODULES_SUPPORT) +// import std; +#endif // #if (MORPHEUS_MODULES_SUPPORT) + #include #include #include From 7a8e4e7e49af63faba928ec3ac499805329eb32c Mon Sep 17 00:00:00 2001 From: Antony Peacock Date: Sat, 4 May 2024 16:49:53 +0100 Subject: [PATCH 14/14] In progress memory header --- modules/std/std/memory.hpp | 475 +++++++++++++++++++++++++++++++++++++ 1 file changed, 475 insertions(+) create mode 100644 modules/std/std/memory.hpp diff --git a/modules/std/std/memory.hpp b/modules/std/std/memory.hpp new file mode 100644 index 00000000..90181546 --- /dev/null +++ b/modules/std/std/memory.hpp @@ -0,0 +1,475 @@ +/// \file memory.hpp +/// Modularisation for https://eel.is/c++draft/memory.syn +export namespace std +{ + +// [pointer.traits], pointer traits +using std::pointer_traits; + +// [pointer.conversion], pointer conversion +using std::to_address; + +// [ptr.align], pointer alignment +using std::align; +using std::assume_aligned; + +#if (__cpp_lib_start_lifetime_as >= 202207L) + // [obj.lifetime], explicit lifetime management + using std::start_lifetime_as; + using std::start_lifetime_as_array; +#endif // (__cpp_lib_start_lifetime_as >= 202207L) + +// [allocator.tag], allocator argument tag +using std::allocator_arg_t; +using std::allocator_arg; + +// [allocator.uses], uses_allocator +using std::uses_allocator; + +// [allocator.uses.trait], uses_allocator +using std::uses_allocator_v; + +// [allocator.uses.construction], uses-allocator construction +using std::uses_allocator_construction_args; +using std::make_obj_using_allocator; +using std::uninitialized_construct_using_allocator; + +// [allocator.traits], allocator traits +using std::allocator_traits; + +#if (cpp_lib_allocate_at_least >= 202302L) + using std::allocation_result; +#endif // (cpp_lib_allocate_at_least >= 202302L) + +// [default.allocator], the default allocator +using std::allocator; +using std::operator==; + +// [specialized.addressof], addressof +using std::addressof; + +// [specialized.algorithms], specialized algorithms +// [special.mem.concepts], special memory concepts +//using std::addressof; +//using std::addressof; + +} // namespace std + + +/* +namespace std { + + // [specialized.algorithms], specialized algorithms + // [special.mem.concepts], special memory concepts + template + concept nothrow-input-iterator = see below; // exposition only + template + concept nothrow-forward-iterator = see below; // exposition only + template + concept nothrow-sentinel-for = see below; // exposition only + template + concept nothrow-input-range = see below; // exposition only + template + concept nothrow-forward-range = see below; // exposition only + + template + void uninitialized_default_construct(NoThrowForwardIterator first, // freestanding + NoThrowForwardIterator last); + template + void uninitialized_default_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, + NoThrowForwardIterator last); + template + NoThrowForwardIterator + uninitialized_default_construct_n(NoThrowForwardIterator first, Size n); // freestanding + template + NoThrowForwardIterator + uninitialized_default_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, Size n); + + namespace ranges { + template S> + requires default_initializable> + I uninitialized_default_construct(I first, S last); // freestanding + template + requires default_initializable> + borrowed_iterator_t uninitialized_default_construct(R&& r); // freestanding + + template + requires default_initializable> + I uninitialized_default_construct_n(I first, iter_difference_t n); // freestanding + } + + template + void uninitialized_value_construct(NoThrowForwardIterator first, // freestanding + NoThrowForwardIterator last); + template + void uninitialized_value_construct(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, + NoThrowForwardIterator last); + template + NoThrowForwardIterator + uninitialized_value_construct_n(NoThrowForwardIterator first, Size n); // freestanding + template + NoThrowForwardIterator + uninitialized_value_construct_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, Size n); + + namespace ranges { + template S> + requires default_initializable> + I uninitialized_value_construct(I first, S last); // freestanding + template + requires default_initializable> + borrowed_iterator_t uninitialized_value_construct(R&& r); // freestanding + + template + requires default_initializable> + I uninitialized_value_construct_n(I first, iter_difference_t n); // freestanding + } + + template + NoThrowForwardIterator uninitialized_copy(InputIterator first, // freestanding + InputIterator last, + NoThrowForwardIterator result); + template + NoThrowForwardIterator uninitialized_copy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + NoThrowForwardIterator result); + template + NoThrowForwardIterator uninitialized_copy_n(InputIterator first, Size n, // freestanding + NoThrowForwardIterator result); + template + NoThrowForwardIterator uninitialized_copy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, Size n, + NoThrowForwardIterator result); + + namespace ranges { + template + using uninitialized_copy_result = in_out_result; // freestanding + template S1, + nothrow-forward-iterator O, nothrow-sentinel-for S2> + requires constructible_from, iter_reference_t> + uninitialized_copy_result + uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding + template + requires constructible_from, range_reference_t> + uninitialized_copy_result, borrowed_iterator_t> + uninitialized_copy(IR&& in_range, OR&& out_range); // freestanding + + template + using uninitialized_copy_n_result = in_out_result; // freestanding + template S> + requires constructible_from, iter_reference_t> + uninitialized_copy_n_result + uninitialized_copy_n(I ifirst, iter_difference_t n, // freestanding + O ofirst, S olast); + } + + template + NoThrowForwardIterator uninitialized_move(InputIterator first, // freestanding + InputIterator last, + NoThrowForwardIterator result); + template + NoThrowForwardIterator uninitialized_move(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, ForwardIterator last, + NoThrowForwardIterator result); + template + pair + uninitialized_move_n(InputIterator first, Size n, // freestanding + NoThrowForwardIterator result); + template + pair + uninitialized_move_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + ForwardIterator first, Size n, NoThrowForwardIterator result); + + namespace ranges { + template + using uninitialized_move_result = in_out_result; // freestanding + template S1, + nothrow-forward-iterator O, nothrow-sentinel-for S2> + requires constructible_from, iter_rvalue_reference_t> + uninitialized_move_result + uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); // freestanding + template + requires constructible_from, range_rvalue_reference_t> + uninitialized_move_result, borrowed_iterator_t> + uninitialized_move(IR&& in_range, OR&& out_range); // freestanding + + template + using uninitialized_move_n_result = in_out_result; // freestanding + template S> + requires constructible_from, iter_rvalue_reference_t> + uninitialized_move_n_result + uninitialized_move_n(I ifirst, iter_difference_t n, // freestanding + O ofirst, S olast); + } + + template + void uninitialized_fill(NoThrowForwardIterator first, // freestanding + NoThrowForwardIterator last, const T& x); + template + void uninitialized_fill(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, NoThrowForwardIterator last, + const T& x); + template + NoThrowForwardIterator + uninitialized_fill_n(NoThrowForwardIterator first, Size n, const T& x); // freestanding + template + NoThrowForwardIterator + uninitialized_fill_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, Size n, const T& x); + + namespace ranges { + template S, class T> + requires constructible_from, const T&> + I uninitialized_fill(I first, S last, const T& x); // freestanding + template + requires constructible_from, const T&> + borrowed_iterator_t uninitialized_fill(R&& r, const T& x); // freestanding + + template + requires constructible_from, const T&> + I uninitialized_fill_n(I first, iter_difference_t n, const T& x); // freestanding + } + + // [specialized.construct], construct_at + template + constexpr T* construct_at(T* location, Args&&... args); // freestanding + + namespace ranges { + template + constexpr T* construct_at(T* location, Args&&... args); // freestanding + } + + // [specialized.destroy], destroy + template + constexpr void destroy_at(T* location); // freestanding + template + constexpr void destroy(NoThrowForwardIterator first, // freestanding + NoThrowForwardIterator last); + template + void destroy(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, NoThrowForwardIterator last); + template + constexpr NoThrowForwardIterator destroy_n(NoThrowForwardIterator first, // freestanding + Size n); + template + NoThrowForwardIterator destroy_n(ExecutionPolicy&& exec, // see [algorithms.parallel.overloads] + NoThrowForwardIterator first, Size n); + + namespace ranges { + template + constexpr void destroy_at(T* location) noexcept; // freestanding + + template S> + requires destructible> + constexpr I destroy(I first, S last) noexcept; // freestanding + template + requires destructible> + constexpr borrowed_iterator_t destroy(R&& r) noexcept; // freestanding + + template + requires destructible> + constexpr I destroy_n(I first, iter_difference_t n) noexcept; // freestanding + } + + // [unique.ptr], class template unique_ptr + template struct default_delete; // freestanding + template struct default_delete; // freestanding + template> class unique_ptr; // freestanding + template class unique_ptr; // freestanding + + template + constexpr unique_ptr make_unique(Args&&... args); // T is not array + template + constexpr unique_ptr make_unique(size_t n); // T is U[] + template + unspecified make_unique(Args&&...) = delete; // T is U[N] + + template + constexpr unique_ptr make_unique_for_overwrite(); // T is not array + template + constexpr unique_ptr make_unique_for_overwrite(size_t n); // T is U[] + template + unspecified make_unique_for_overwrite(Args&&...) = delete; // T is U[N] + + template + constexpr void swap(unique_ptr& x, unique_ptr& y) noexcept; // freestanding + + template + constexpr bool operator==(const unique_ptr& x, // freestanding + const unique_ptr& y); + template + bool operator<(const unique_ptr& x, const unique_ptr& y); // freestanding + template + bool operator>(const unique_ptr& x, const unique_ptr& y); // freestanding + template + bool operator<=(const unique_ptr& x, const unique_ptr& y); // freestanding + template + bool operator>=(const unique_ptr& x, const unique_ptr& y); // freestanding + template + requires three_way_comparable_with::pointer, + typename unique_ptr::pointer> + compare_three_way_result_t::pointer, + typename unique_ptr::pointer> + operator<=>(const unique_ptr& x, const unique_ptr& y); // freestanding + + template + constexpr bool operator==(const unique_ptr& x, nullptr_t) noexcept; // freestanding + template + constexpr bool operator<(const unique_ptr& x, nullptr_t); // freestanding + template + constexpr bool operator<(nullptr_t, const unique_ptr& y); // freestanding + template + constexpr bool operator>(const unique_ptr& x, nullptr_t); // freestanding + template + constexpr bool operator>(nullptr_t, const unique_ptr& y); // freestanding + template + constexpr bool operator<=(const unique_ptr& x, nullptr_t); // freestanding + template + constexpr bool operator<=(nullptr_t, const unique_ptr& y); // freestanding + template + constexpr bool operator>=(const unique_ptr& x, nullptr_t); // freestanding + template + constexpr bool operator>=(nullptr_t, const unique_ptr& y); // freestanding + template + requires three_way_comparable::pointer> + constexpr compare_three_way_result_t::pointer> + operator<=>(const unique_ptr& x, nullptr_t); // freestanding + + template + basic_ostream& operator<<(basic_ostream& os, const unique_ptr& p); + + // [util.smartptr.weak.bad], class bad_weak_ptr + class bad_weak_ptr; + + // [util.smartptr.shared], class template shared_ptr + template class shared_ptr; + + // [util.smartptr.shared.create], shared_ptr creation + template + shared_ptr make_shared(Args&&... args); // T is not array + template + shared_ptr allocate_shared(const A& a, Args&&... args); // T is not array + + template + shared_ptr make_shared(size_t N); // T is U[] + template + shared_ptr allocate_shared(const A& a, size_t N); // T is U[] + + template + shared_ptr make_shared(); // T is U[N] + template + shared_ptr allocate_shared(const A& a); // T is U[N] + + template + shared_ptr make_shared(size_t N, const remove_extent_t& u); // T is U[] + template + shared_ptr allocate_shared(const A& a, size_t N, + const remove_extent_t& u); // T is U[] + + template + shared_ptr make_shared(const remove_extent_t& u); // T is U[N] + template + shared_ptr allocate_shared(const A& a, const remove_extent_t& u); // T is U[N] + + template + shared_ptr make_shared_for_overwrite(); // T is not U[] + template + shared_ptr allocate_shared_for_overwrite(const A& a); // T is not U[] + + template + shared_ptr make_shared_for_overwrite(size_t N); // T is U[] + template + shared_ptr allocate_shared_for_overwrite(const A& a, size_t N); // T is U[] + + // [util.smartptr.shared.cmp], shared_ptr comparisons + template + bool operator==(const shared_ptr& a, const shared_ptr& b) noexcept; + template + strong_ordering operator<=>(const shared_ptr& a, const shared_ptr& b) noexcept; + + template + bool operator==(const shared_ptr& x, nullptr_t) noexcept; + template + strong_ordering operator<=>(const shared_ptr& x, nullptr_t) noexcept; + + // [util.smartptr.shared.spec], shared_ptr specialized algorithms + template + void swap(shared_ptr& a, shared_ptr& b) noexcept; + + // [util.smartptr.shared.cast], shared_ptr casts + template + shared_ptr static_pointer_cast(const shared_ptr& r) noexcept; + template + shared_ptr static_pointer_cast(shared_ptr&& r) noexcept; + template + shared_ptr dynamic_pointer_cast(const shared_ptr& r) noexcept; + template + shared_ptr dynamic_pointer_cast(shared_ptr&& r) noexcept; + template + shared_ptr const_pointer_cast(const shared_ptr& r) noexcept; + template + shared_ptr const_pointer_cast(shared_ptr&& r) noexcept; + template + shared_ptr reinterpret_pointer_cast(const shared_ptr& r) noexcept; + template + shared_ptr reinterpret_pointer_cast(shared_ptr&& r) noexcept; + + // [util.smartptr.getdeleter], shared_ptr get_deleter + template + D* get_deleter(const shared_ptr& p) noexcept; + + // [util.smartptr.shared.io], shared_ptr I/O + template + basic_ostream& operator<<(basic_ostream& os, const shared_ptr& p); + + // [util.smartptr.weak], class template weak_ptr + template class weak_ptr; + + // [util.smartptr.weak.spec], weak_ptr specialized algorithms + template void swap(weak_ptr& a, weak_ptr& b) noexcept; + + // [util.smartptr.ownerless], class template owner_less + template struct owner_less; + + // [util.smartptr.owner.hash], struct owner_hash + struct owner_hash; + + // [util.smartptr.owner.equal], struct owner_equal + struct owner_equal; + + // [util.smartptr.enab], class template enable_shared_from_this + template class enable_shared_from_this; + + // [util.smartptr.hash], hash support + template struct hash; // freestanding + template struct hash>; // freestanding + template struct hash>; + + // [util.smartptr.atomic], atomic smart pointers + template struct atomic; // freestanding + template struct atomic>; + template struct atomic>; + + // [out.ptr.t], class template out_ptr_t + template + class out_ptr_t; // freestanding + + // [out.ptr], function template out_ptr + template + auto out_ptr(Smart& s, Args&&... args); // freestanding + + // [inout.ptr.t], class template inout_ptr_t + template + class inout_ptr_t; // freestanding + + // [inout.ptr], function template inout_ptr + template + auto inout_ptr(Smart& s, Args&&... args); // freestanding +} +*/