// C++11 https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf // C++14 https://github.com/cplusplus/draft/blob/main/papers/n4140.pdf // C++17 https://open-std.org/jtc1/sc22/wg21/docs/papers/2017/n4659.pdf // C++20 https://open-std.org/jtc1/sc22/wg21/docs/papers/2020/n4868.pdf // C++23 https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/n4950.pdf // https://en.cppreference.com/w/cpp // https://en.cppreference.com/w/cpp/header // https://en.cppreference.com/w/cpp/links alignas alignof asm break case catch class concept const const_cast consteval constexpr constinit continue co_await co_return co_yield decltype default delete do dynamic_cast else enum explicit export extern false for friend goto if inline mutable namespace new noexcept nullptr operator private protected public register reinterpret_cast requires return sizeof static static_assert static_cast struct switch template this thread_local throw true try typedef typeid typename union using virtual volatile while final import module override auto bool char char8_t char16_t char32_t double float int long short signed unsigned wchar_t void and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq // Conditional inclusion __has_include(header) __has_cpp_attribute(pp-tokens) // Argument substitution __VA_OPT__ // Predefined macro names __cplusplus __STDCPP_DEFAULT_NEW_ALIGNMENT__ // Feature-test macros __STDCPP_STRICT_POINTER_SAFETY__ __STDCPP_THREADS__ // attributes https://en.cppreference.com/w/cpp/language/attributes [[assume]] [[carries_dependency]] [[deprecated]] [[indeterminate]] [[likely]] [[maybe_unused]] [[no_unique_address]] [[nodiscard]] [[noreturn]] [[optimize_for_synchronized]] [[unlikely]] #include namespace std { // Common definitions nullptr_t = decltype(nullptr); enum class byte : unsigned char {}; template constexpr IntType to_integer(byte b) noexcept; } // Implementation properties #include // C++20 #include namespace std { // Implementation properties enum float_round_style { round_indeterminate, round_toward_zero, round_to_nearest, round_toward_infinity, round_toward_neg_infinity, }; enum float_denorm_style { denorm_indeterminate, denorm_absent, denorm_present, }; template class numeric_limits { bool is_specialized; T min(); T max(); T lowest(); int digits; int digits10; int max_digits10; bool is_signed; bool is_integer; bool is_exact; int radix; T epsilon(); T round_error(); int min_exponent; int min_exponent10; int max_exponent; int max_exponent10; bool has_infinity; bool has_quiet_NaN; bool has_signaling_NaN; float_denorm_style has_denorm; bool has_denorm_loss; T infinity(); T quiet_NaN(); T signaling_NaN(); T denorm_min(); bool is_iec559; bool is_bounded; bool is_modulo; bool traps; bool tinyness_before; float_round_style round_style; }; } #include // C++23 namespace std { // Arithmetic types float16_t float32_t float64_t float128_t bfloat16_t } #include namespace std { // Dynamic memory management class bad_alloc : public exception {}; class bad_array_new_length : public bad_alloc {}; struct destroying_delete_t { // C++20 explicit destroying_delete_t() = default; }; constexpr destroying_delete_t destroying_delete {}; //C++20 enum class align_val_t : size_t {}; struct nothrow_t {}; extern const nothrow_t nothrow; using new_handler = void (*)(); new_handler get_new_handler() noexcept; new_handler set_new_handler(new_handler new_p) noexcept; template [[nodiscard]] constexpr T* launder(T* p) noexcept; size_t hardware_destructive_interference_size; size_t hardware_constructive_interference_size; [[nodiscard]] void* operator new(size_t size); void operator delete(void* ptr) noexcept; [[nodiscard]] void* operator new[](std::size_t size); void operator delete[](void* ptr) noexcept; } #include namespace std { // Type identification class type_info { bool before(const type_info& rhs) const noexcept; size_t hash_code() const noexcept; const char* name() const noexcept; }; class bad_cast : public exception {}; class bad_typeid : public exception {}; } #include // C++20 namespace std { // Source location struct source_location { static consteval source_location current() noexcept; constexpr uint_least32_t line() const noexcept; constexpr uint_least32_t column() const noexcept; constexpr const char* file_name() const noexcept; constexpr const char* function_name() const noexcept; }; } #include // C++2x namespace std { // Contract violation handling class contract_violation { uint_least32_t line_number() const noexcept; string_view file_name() const noexcept; string_view function_name() const noexcept; string_view comment() const noexcept; string_view assertion_level() const noexcept; }; } #include // C++20 namespace std { // Comparisons class partial_ordering { static const partial_ordering less; static const partial_ordering equivalent; static const partial_ordering greater; static const partial_ordering unordered; }; class weak_ordering { static const weak_ordering less; static const weak_ordering equivalent; static const weak_ordering greater; }; class strong_ordering { static const strong_ordering less; static const strong_ordering equal; static const strong_ordering equivalent; static const strong_ordering greater; }; constexpr bool is_eq(partial_ordering cmp) noexcept { return cmp == 0; } constexpr bool is_neq(partial_ordering cmp) noexcept { return cmp != 0; } constexpr bool is_lt(partial_ordering cmp) noexcept { return cmp < 0; } constexpr bool is_lteq(partial_ordering cmp) noexcept { return cmp <= 0; } constexpr bool is_gt(partial_ordering cmp) noexcept { return cmp > 0; } constexpr bool is_gteq(partial_ordering cmp) noexcept { return cmp >= 0; } template struct common_comparison_category { using type; }; template using common_comparison_category_t = typename common_comparison_category::type; template concept three_way_comparable; template concept three_way_comparable_with; template struct compare_three_way_result; template using compare_three_way_result_t = typename compare_three_way_result::type; struct compare_three_way { using is_transparent; }; inline namespace { constexpr strong_order(E, F); constexpr weak_order(E, F); constexpr partial_order(E, F); constexpr compare_strong_order_fallback(E, F); constexpr compare_weak_order_fallback(E, F); constexpr compare_partial_order_fallback(E, F); } } #include // C++20 namespace std { // Coroutines template struct coroutine_traits { using promise_type = typename R::promise_type; }; template <> struct coroutine_handle { constexpr void* address() const noexcept; static constexpr coroutine_handle from_address(void* addr); bool done() const; void resume() const; void destroy() const; }; template struct coroutine_handle : coroutine_handle<> { using coroutine_handle<>::coroutine_handle; static coroutine_handle from_promise(Promise&); static constexpr coroutine_handle from_address(void* addr); Promise& promise() const; }; struct noop_coroutine_promise; template <> struct coroutine_handle : coroutine_handle<> { constexpr bool done() const noexcept; constexpr void resume() const noexcept; constexpr void destroy() const noexcept; noop_coroutine_promise& promise() const noexcept; constexpr void* address() const noexcept; }; using noop_coroutine_handle = coroutine_handle; noop_coroutine_handle noop_coroutine() noexcept; struct suspend_never { constexpr bool await_ready() const noexcept; constexpr void await_suspend(coroutine_handle<>) const noexcept {} constexpr void await_resume() const noexcept {} }; struct suspend_always; } #include // C++20 namespace std { // Concepts // language-related concepts template concept same_as; template concept derived_from ; template concept convertible_to; template concept common_reference_with; template concept common_with; template concept integral; template concept signed_integral; template concept unsigned_integral; template concept floating_point; template concept assignable_from; template concept swappable; template concept swappable_with; template concept destructible; template concept constructible_from; template concept default_initializable; template concept move_constructible; template concept copy_constructible ; // comparison concepts template concept equality_comparable; template concept equality_comparable_with; template concept totally_ordered; template concept totally_ordered_with; // object concepts template concept movable; template concept copyable; template concept semiregular; template concept regular; // callable concepts template concept invocable; template concept regular_invocable; template concept predicate; template concept relation; template concept equivalence_relation; template concept strict_weak_order; } #include namespace std { // Exception handling class exception { const char* what() const noexcept; } class bad_exception : public exception {}; class nested_exception { [[noreturn]] void rethrow_nested() const; exception_ptr nested_ptr() const noexcept; }; using terminate_handler = void (*)(); terminate_handler get_terminate() noexcept; terminate_handler set_terminate(terminate_handler f) noexcept; [[noreturn]] void terminate() noexcept; int uncaught_exceptions() noexcept; using exception_ptr; exception_ptr current_exception() noexcept; [[noreturn]] void rethrow_exception(exception_ptr p); template exception_ptr make_exception_ptr(E e) noexcept; template [[noreturn]] void throw_with_nested(T&& t); template void rethrow_if_nested(const E& e); } #include namespace std { // Initializer lists template class initializer_list { using value_type = E; using reference = const E&; using const_reference = const E&; using size_type = size_t; using iterator = const E*; using const_iterator = const E*; constexpr size_t size() const noexcept; constexpr const E* begin() const noexcept; constexpr const E* end() const noexcept; }; } #include namespace std { // Exception classes class logic_error : public exception {}; class domain_error : public logic_error {}; class invalid_argument : public logic_error {}; class length_error : public logic_error {}; class out_of_range : public logic_error {}; class runtime_error : public exception {}; class range_error : public runtime_error {}; class overflow_error : public runtime_error {}; class underflow_error : public runtime_error {}; } #include namespace std { // System error support class error_category { const char* name() const noexcept = 0; error_condition default_error_condition(int ev) const noexcept; bool equivalent(int code, const error_condition& condition) const noexcept; bool equivalent(const error_code& code, int condition) const noexcept; string message(int ev) const = 0; }; const error_category& generic_category() noexcept; const error_category& system_category() noexcept; class error_code { void assign(int val, const error_category& cat) noexcept; void clear() noexcept; int value() const noexcept; const error_category& category() const noexcept; error_condition default_error_condition() const noexcept; string message() const; }; class error_condition { void assign(int val, const error_category& cat) noexcept; void clear() noexcept; int value() const noexcept; const error_category& category() const noexcept; string message() const; }; class system_error : public runtime_error { const error_code& code() const noexcept; }; template struct is_error_code_enum : public false_type {}; template struct is_error_condition_enum : public false_type {}; enum class errc { address_family_not_supported, // EAFNOSUPPORT address_in_use, // EADDRINUSE address_not_available, // EADDRNOTAVAIL already_connected, // EISCONN argument_list_too_long, // E2BIG argument_out_of_domain, // EDOM bad_address, // EFAULT bad_file_descriptor, // EBADF bad_message, // EBADMSG broken_pipe, // EPIPE connection_aborted, // ECONNABORTED connection_already_in_progress, // EALREADY connection_refused, // ECONNREFUSED connection_reset, // ECONNRESET cross_device_link, // EXDEV destination_address_required, // EDESTADDRREQ device_or_resource_busy, // EBUSY directory_not_empty, // ENOTEMPTY executable_format_error, // ENOEXEC file_exists, // EEXIST file_too_large, // EFBIG filename_too_long, // ENAMETOOLONG function_not_supported, // ENOSYS host_unreachable, // EHOSTUNREACH identifier_removed, // EIDRM illegal_byte_sequence, // EILSEQ inappropriate_io_control_operation, // ENOTTY interrupted, // EINTR invalid_argument, // EINVAL invalid_seek, // ESPIPE io_error, // EIO is_a_directory, // EISDIR message_size, // EMSGSIZE network_down, // ENETDOWN network_reset, // ENETRESET network_unreachable, // ENETUNREACH no_buffer_space, // ENOBUFS no_child_process, // ECHILD no_link, // ENOLINK no_lock_available, // ENOLCK no_message_available, // ENODATA no_message, // ENOMSG no_protocol_option, // ENOPROTOOPT no_space_on_device, // ENOSPC no_stream_resources, // ENOSR no_such_device_or_address, // ENXIO no_such_device, // ENODEV no_such_file_or_directory, // ENOENT no_such_process, // ESRCH not_a_directory, // ENOTDIR not_a_socket, // ENOTSOCK not_a_stream, // ENOSTR not_connected, // ENOTCONN not_enough_memory, // ENOMEM not_supported, // ENOTSUP operation_canceled, // ECANCELED operation_in_progress, // EINPROGRESS operation_not_permitted, // EPERM operation_not_supported, // EOPNOTSUPP operation_would_block, // EWOULDBLOCK owner_dead, // EOWNERDEAD permission_denied, // EACCES protocol_error, // EPROTO protocol_not_supported, // EPROTONOSUPPORT read_only_file_system, // EROFS resource_deadlock_would_occur, // EDEADLK resource_unavailable_try_again, // EAGAIN result_out_of_range, // ERANGE state_not_recoverable, // ENOTRECOVERABLE stream_timeout, // ETIME text_file_busy, // ETXTBSY timed_out, // ETIMEDOUT too_many_files_open_in_system, // ENFILE too_many_files_open, // EMFILE too_many_links, // EMLINK too_many_symbolic_link_levels, // ELOOP value_too_large, // EOVERFLOW wrong_protocol_type, // EPROTOTYPE }; template <> struct is_error_condition_enum : true_type {}; error_code make_error_code(errc e) noexcept; error_condition make_error_condition(errc e) noexcept; template struct hash; template <> struct hash; template <> struct hash; template constexpr bool is_error_code_enum_v = is_error_code_enum::value; template constexpr bool is_error_condition_enum_v = is_error_condition_enum::value; } #include // C++23 namespace std { // Stacktrace class stacktrace_entry { using native_handle_type; constexpr native_handle_type native_handle() const noexcept; string description() const; string source_file() const; uint_least32_t source_line() const; }; template class basic_stacktrace { static basic_stacktrace current(const allocator_type& alloc = allocator_type()) noexcept; }; using stacktrace = basic_stacktrace>; } #include namespace std { // Utility components namespace rel_ops {} template void swap(T& a, T& b) noexcept(); template void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v); template T exchange(T& obj, U&& new_val); // Forward/move helpers template constexpr T&& forward(remove_reference_t& t) noexcept; template constexpr T&& forward(remove_reference_t&& t) noexcept; template [[nodiscard]] constexpr auto forward_like(U&& x) noexcept; template constexpr remove_reference_t&& move(T&&) noexcept; template constexpr conditional_t && is_copy_constructible_v, const T&, T&&> move_if_noexcept(T& x) noexcept; template constexpr add_const_t& as_const(T& t) noexcept; template add_rvalue_reference_t declval() noexcept; // Integer comparison functions template constexpr bool cmp_equal(T t, U u) noexcept; template constexpr bool cmp_not_equal(T t, U u) noexcept; template constexpr bool cmp_less(T t, U u) noexcept; template constexpr bool cmp_greater(T t, U u) noexcept; template constexpr bool cmp_less_equal(T t, U u) noexcept; template constexpr bool cmp_greater_equal(T t, U u) noexcept; template constexpr bool in_range(T t) noexcept; template constexpr underlying_type_t to_underlying(T value) noexcept; [[noreturn]] void unreachable(); // Compile-time integer sequences template struct integer_sequence { using value_type = T; size_t size(); }; template using index_sequence = integer_sequence; template using make_integer_sequence = integer_sequence; template using make_index_sequence = make_integer_sequence; template using index_sequence_for = make_index_sequence; // Pairs template struct pair { using first_type; using second_type; T1 first; T2 second; }; template constexpr make_pair(T1&&, T2&&); template class tuple_size; template class tuple_element; template constexpr tuple_element_t>& get(pair&) noexcept; // Piecewise construction struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; constexpr piecewise_construct_t piecewise_construct{}; struct in_place_t { explicit in_place_t() = default; }; constexpr in_place_t in_place{}; template struct in_place_type_t { explicit in_place_type_t() = default; }; template constexpr in_place_type_t in_place_type{}; template struct in_place_index_t { explicit in_place_index_t() = default; }; template constexpr in_place_index_t in_place_index{}; } #include namespace std { // Tuples template class tuple {}; constexpr ignore; template constexpr tuple make_tuple(TTypes&&...); template constexpr tuple forward_as_tuple(TTypes&&...) noexcept; template constexpr tuple tie(TTypes&...) noexcept; template constexpr tuple tuple_cat(Tuples&&...); template constexpr decltype(auto) apply(F&& f, Tuple&& t); template constexpr T make_from_tuple(Tuple&& t); template struct uses_allocator, Alloc>; template constexpr size_t tuple_size_v = tuple_size::value; } #include namespace std { // Optional objects template class optional { using value_type = T; template T& emplace(Args&&...); constexpr bool has_value() const noexcept; constexpr const T& value() const&; template constexpr T value_or(U&&) const&; template constexpr auto and_then(F&& f) &; template constexpr auto transform(F&& f) &; template constexpr optional or_else(F&& f) &&; void reset() noexcept; }; struct nullopt_t {}; constexpr nullopt_t nullopt(); class bad_optional_access : public exception {}; template constexpr optional<> make_optional(T&&); template constexpr optional make_optional(Args&&... args); } #include namespace std { // Variants template class variant { template T& emplace(Args&&...); constexpr bool valueless_by_exception() const noexcept; constexpr size_t index() const noexcept; }; template struct variant_size; template constexpr size_t variant_size_v = variant_size::value; template struct variant_alternative; template using variant_alternative_t = typename variant_alternative::type; constexpr size_t variant_npos = -1; template constexpr bool holds_alternative(const variant&) noexcept; template constexpr variant_alternative_t>& get(variant&); template constexpr add_pointer_t get_if(variant*) noexcept; template constexpr visit(Visitor&&, Variants&&...); struct monostate; class bad_variant_access : public exception {}; } #include namespace std { // Storage for any type class bad_any_cast : public bad_cast {}; class any { template decay_t& emplace(Args&& ...); void reset() noexcept; void swap(any& rhs) noexcept; bool has_value() const noexcept; const type_info& type() const noexcept; }; template any make_any(Args&& ...args); template T any_cast(const any& operand); } #include // C++23 namespace std { // Expected objects template class unexpected { constexpr const E& error() const & noexcept; }; template class bad_expected_access : public bad_expected_access { E& error() & noexcept; }; template <> class bad_expected_access : public exception {}; struct unexpect_t { explicit unexpect_t() = default; }; constexpr unexpect_t unexpect{}; template class expected { using value_type = T; using error_type = E; using unexpected_type = unexpected; template using rebind = expected; constexpr bool has_value() const noexcept; constexpr const T& value() const &; constexpr const E& error() const & noexcept; template constexpr T value_or(U&&) const &; template constexpr E error_or(G&&) const &; template constexpr auto and_then(F&& f) &; template constexpr auto or_else(F&& f) &; template constexpr auto transform(F&& f) &; template constexpr auto transform_error(F&& f) &; }; } #include namespace std { // Bitsets template class bitset { // bit reference: class reference { reference& flip() noexcept; // for b[i].flip(); }; bitset& set() noexcept; bitset& set(size_t pos, bool val = true); bitset& reset() noexcept; bitset& reset(size_t pos); bitset& flip() noexcept; bitset& flip(size_t pos); unsigned long to_ulong() const; unsigned long long to_ullong() const; basic_string to_string() const; size_t count() const noexcept; constexpr size_t size() const noexcept; bool test(size_t pos) const; bool all() const noexcept; bool any() const noexcept; bool none() const noexcept; }; } #include namespace std { // Memory template struct pointer_traits { using pointer = Ptr; using element_type; using difference_type; template using rebind; static pointer pointer_to(r); }; template struct pointer_traits; template auto to_address(const Ptr& p) noexcept; // C++20 enum class pointer_safety { relaxed, preferred, strict }; // Pointer safety void declare_reachable(void* p); template T* undeclare_reachable(T* p); void declare_no_pointers(char* p, size_t n); void undeclare_no_pointers(char* p, size_t n); pointer_safety get_pointer_safety() noexcept; // Align void* align(size_t alignment, size_t size, void*& ptr, size_t& space); template [[nodiscard]] constexpr T* assume_aligned(T* ptr); // C++20 template T* start_lifetime_as(void* p) noexcept; template T* start_lifetime_as_array(void* p, size_t n) noexcept; // Allocator argument tag struct allocator_arg_t { explicit allocator_arg_t() = default; }; constexpr allocator_arg_t allocator_arg{}; // uses_allocator template struct uses_allocator; template constexpr bool uses_allocator_v = uses_allocator::value; template auto uses_allocator_construction_args(const Alloc& alloc); // C++20 template T make_obj_using_allocator(const Alloc& alloc, Args&&... args); // C++20 template T* uninitialized_construct_using_allocator(T* p, const Alloc& alloc, Args&&... args); // C++20 // Allocator traits template struct allocator_traits { using allocator_type = Alloc; using value_type = typename Alloc::value_type; using pointer; using const_pointer; using void_pointer; using const_void_pointer; using propagate_on_container_copy_assignment; using propagate_on_container_move_assignment; using propagate_on_container_swap; using is_always_equal; template using rebind_alloc; template using rebind_traits; [[nodiscard]] static pointer allocate(Alloc& a, size_type n); [[nodiscard]] static pointer allocate(Alloc& a, size_type n, const_void_pointer hint); static void deallocate(Alloc& a, pointer p, size_type n); template static void construct(Alloc& a, T* p, Args&&... args); template static void destroy(Alloc& a, T* p); static size_type max_size(const Alloc& a) noexcept; static Alloc select_on_container_copy_construction(const Alloc& rhs); }; template struct allocation_result { Pointer ptr; SizeType count; }; // The default allocator template class allocator; template constexpr T* addressof(T& r) noexcept; // Specialized algorithms template void uninitialized_default_construct(ForwardIterator first, ForwardIterator last); template ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n) template void uninitialized_value_construct(ForwardIterator first, ForwardIterator last); template ForwardIterator uninitialized_value_construct_n(ForwardIterator first, Size n); template ForwardIterator uninitialized_copy(InputIterator first, InputIterator last, ForwardIterator result); template ForwardIterator uninitialized_copy_n(InputIterator first, Size n, ForwardIterator result); template ForwardIterator uninitialized_move(InputIterator first, InputIterator last, ForwardIterator result); template pair uninitialized_move_n(InputIterator first, Size n, ForwardIterator result); template void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x); template ForwardIterator uninitialized_fill_n(ForwardIterator first, Size n, const T& x); template constexpr T* construct_at(T* location, Args&&... args); template void destroy_at(T* location); template void destroy(ForwardIterator first, ForwardIterator last); template ForwardIterator destroy_n(ForwardIterator first, Size n); // unique_ptr template struct default_delete; template struct default_delete; template > class unique_ptr { using pointer; using element_type = T; using deleter_type = D; pointer get() const noexcept; deleter_type& get_deleter() noexcept pointer release() noexcept; void reset(pointer p = pointer()) noexcept; void swap(unique_ptr& u) noexcept; }; template class unique_ptr; template unique_ptr make_unique(Args&&... args); template unique_ptr make_unique(size_t n); template unique_ptr make_unique_for_overwrite(size_t n); // C++20 template void swap(unique_ptr& x, unique_ptr& y) noexcept; // Shared-ownership pointers class bad_weak_ptr : public exception {}; template class shared_ptr { using element_type = remove_extent_t; using weak_type = weak_ptr; void swap(shared_ptr& r) noexcept; void reset() noexcept; element_type* get() const noexcept; long use_count() const noexcept; template bool owner_before(const shared_ptr& b) const noexcept; }; template shared_ptr make_shared(Args&&... args); template shared_ptr allocate_shared(const A& a, Args&&... args); template shared_ptr make_shared_for_overwrite(size_t N); // C++20 template shared_ptr allocate_shared_for_overwrite(const A& a, size_t N); // C++20 template shared_ptr static_pointer_cast(const shared_ptr& r) noexcept; template shared_ptr dynamic_pointer_cast(const shared_ptr& r) noexcept; template shared_ptr const_pointer_cast(const shared_ptr& r) noexcept; template shared_ptr reinterpret_pointer_cast(const shared_ptr& r) noexcept; template D* get_deleter(const shared_ptr& p) noexcept; template class weak_ptr { using element_type = T; long use_count() const noexcept; bool expired() const noexcept; shared_ptr lock() const noexcept; }; template struct owner_less; template <> struct owner_less { using is_transparent; }; struct owner_hash; struct owner_equal; template class enable_shared_from_this { shared_ptr shared_from_this(); shared_ptr shared_from_this() const; weak_ptr weak_from_this() noexcept; weak_ptr weak_from_this() const noexcept; }; template bool atomic_is_lock_free(const shared_ptr* p); template class out_ptr_t; template auto out_ptr(Smart& s, Args&&... args); template class inout_ptr_t; template auto inout_ptr(Smart& s, Args&&... args); template [[deprecated]] struct auto_ptr_ref {}; // C++03 template [[deprecated]] class auto_ptr {}; // C++03 } #include namespace std::pmr { // Memory resources class memory_resource { static constexpr size_t max_align = alignof(max_align_t); [[nodiscard]] void* allocate(size_t bytes, size_t alignment = max_align); void deallocate(void* p, size_t bytes, size_t alignment = max_align); bool is_equal(const memory_resource& other) const noexcept; }; template class polymorphic_allocator { using value_type = Tp; [[nodiscard]] Tp* allocate(size_t n); void deallocate(Tp* p, size_t n); void* allocate_bytes(size_t nbytes, size_t alignment = alignof(max_align_t)); void deallocate_bytes(void* p, size_t nbytes, size_t alignment = alignof(max_align_t)); template T* allocate_object(size_t n = 1); template void deallocate_object(T* p, size_t n = 1); template T* new_object(CtorArgs&&... ctor_args); template void delete_object(T* p); template void construct(T* p, Args&&... args); template void destroy(T* p); polymorphic_allocator select_on_container_copy_construction() const; memory_resource* resource() const; }; memory_resource* new_delete_resource() noexcept; memory_resource* null_memory_resource() noexcept; memory_resource* set_default_resource(memory_resource* r) noexcept; memory_resource* get_default_resource() noexcept; // Pool resource struct pool_options { size_t max_blocks_per_chunk = 0; size_t largest_required_pool_block = 0; }; class synchronized_pool_resource : public memory_resource { void release(); memory_resource* upstream_resource() const; pool_options options() const; }; class unsynchronized_pool_resource : public memory_resource {}; class monotonic_buffer_resource : public memory_resource {}; } #include namespace std { template class scoped_allocator_adaptor : public OuterAlloc { using outer_allocator_type = OuterAlloc; using inner_allocator_type; using propagate_on_container_copy_assignment; using propagate_on_container_move_assignment; using propagate_on_container_swap; using is_always_equal; template struct rebind { using other = scoped_allocator_adaptor, InnerAllocs...>; }; inner_allocator_type& inner_allocator() noexcept; const inner_allocator_type& inner_allocator() const noexcept; outer_allocator_type& outer_allocator() noexcept; const outer_allocator_type& outer_allocator() const noexcept; scoped_allocator_adaptor select_on_container_copy_construction() const; }; } #include namespace std { // Function objects template invoke_result_t invoke(F&& f, Args&&... args) noexcept(is_nothrow_invocable_v); template constexpr R invoke_r(F&& f, Args&&... args); template class reference_wrapper { using type = T; T& get() const noexcept; }; template reference_wrapper ref(T&) noexcept; template reference_wrapper cref(const T&) noexcept; // arithmetic operations template struct plus; template struct minus; template struct multiplies; template struct divides; template struct modulus; template struct negate; // comparisons template struct equal_to; template struct not_equal_to; template struct greater; template struct less; template struct greater_equal; template struct less_equal; struct compare_three_way; // logical operations template struct logical_and; template struct logical_or; template struct logical_not; // bitwise operations template struct bit_and; template struct bit_or; template struct bit_xor; template struct bit_not; struct identity { // // C++20 using is_transparent }; template not_fn(F&& f); template bind_front(F&&, Args&&...); // C++20 template struct is_bind_expression; template struct is_placeholder; template bind(F&&, BoundArgs&&...); template mem_fn(R T::*) noexcept; class bad_function_call : public exception {}; template class function { using result_type = R; const type_info& target_type() const noexcept; template T* target() noexcept; template const T* target() const noexcept; }; template class move_only_function; template > class default_searcher; template ::value_type>>, class boyer_moore_searcher; template ::value_type>, class BinaryPredicate = equal_to<>> class boyer_moore_horspool_searcher; template constexpr bool is_bind_expression_v = is_bind_expression::value; template constexpr int is_placeholder_v = is_placeholder::value; namespace ranges { // C++20 // concept-constrained comparisons struct equal_to; struct not_equal_to; struct greater; struct less; struct greater_equal; struct less_equal; } // deprecated C++03 function objects and binders template struct unary_function {}; // C++03 template struct binary_function {}; // C++03 template class pointer_to_unary_function : public unary_function {}; // C++03 template class pointer_to_binary_function : public binary_function {}; // C++03 template class mem_fun_t : public unary_function {}; // C++03 template class mem_fun1_t : public binary_function {}; // C++03 template class mem_fun_ref_t : public unary_function {}; // C++03 template class mem_fun1_ref_t : public binary_function {}; // C++03 template class const_mem_fun_t : public unary_function {}; // C++03 template class const_mem_fun1_t : public binary_function {}; // C++03 template class const_mem_fun1_ref_t : public binary_function {}; // C++03 template class binder1st : public unary_function {}; // C++03 template class binder2nd : public unary_function {}; // C++03 } #include namespace std { // Metaprogramming and type traits template struct integral_constant { static constexpr T value = v; using value_type = T; using type = integral_constant; constexpr operator value_type() const noexcept { return value; } constexpr value_type operator()() const noexcept { return value; } }; template using bool_constant = integral_constant; using true_type = bool_constant; using false_type = bool_constant; // primary type categories template struct is_void; template struct is_null_pointer; template struct is_integral; template struct is_floating_point; template struct is_array; template struct is_pointer; template struct is_lvalue_reference; template struct is_rvalue_reference; template struct is_member_object_pointer; template struct is_member_function_pointer; template struct is_enum; template struct is_union; template struct is_class; template struct is_function; // composite type categories template struct is_reference; template struct is_arithmetic; template struct is_fundamental; template struct is_object; template struct is_scalar; template struct is_compound; template struct is_member_pointer; // type properties template struct is_const; template struct is_volatile; template struct is_trivial; template struct is_trivially_copyable; template struct is_standard_layout; template [[deprecated]] struct is_pod; // C++17 template struct is_empty; template struct is_polymorphic; template struct is_abstract; template struct is_final; template struct is_aggregate; template struct is_signed; template struct is_unsigned; template struct is_bounded_array; // C++20 template struct is_unbounded_array; // C++20 template struct is_scoped_enum; // C++23 template struct is_constructible; template struct is_default_constructible; template struct is_copy_constructible; template struct is_move_constructible; template struct is_assignable; template struct is_copy_assignable; template struct is_move_assignable; template struct is_swappable_with; template struct is_swappable; template struct is_destructible; template struct is_trivially_constructible; template struct is_trivially_default_constructible; template struct is_trivially_copy_constructible; template struct is_trivially_move_constructible; template struct is_trivially_assignable; template struct is_trivially_copy_assignable; template struct is_trivially_move_assignable; template struct is_trivially_destructible; template struct is_nothrow_constructible; template struct is_nothrow_default_constructible; template struct is_nothrow_copy_constructible; template struct is_nothrow_move_constructible; template struct is_nothrow_assignable; template struct is_nothrow_copy_assignable; template struct is_nothrow_move_assignable; template struct is_nothrow_swappable_with; template struct is_nothrow_swappable; template struct is_nothrow_destructible; template struct is_implicit_lifetime; // C++23 template struct has_virtual_destructor; template struct has_unique_object_representations; template struct reference_constructs_from_temporary; // C++23 template struct reference_converts_from_temporary; // C++23 // type property queries template struct alignment_of; template struct rank; template struct extent; // type relations template struct is_same; template struct is_base_of; template struct is_convertible; template struct is_nothrow_convertible; // C++20 template struct is_layout_compatible; // C++20 template struct is_pointer_interconvertible_base_of; // C++20 template struct is_invocable; template struct is_invocable_r; template struct is_nothrow_invocable; template struct is_nothrow_invocable_r; // const-volatile modifications template struct remove_const; template struct remove_volatile; template struct remove_cv; template struct add_const; template struct add_volatile; template struct add_cv; template using remove_const_t = typename remove_const::type; template using remove_volatile_t = typename remove_volatile::type; template using remove_cv_t = typename remove_cv::type; template using add_const_t = typename add_const::type; template using add_volatile_t = typename add_volatile::type; template using add_cv_t = typename add_cv::type; // reference modifications template struct remove_reference; template struct add_lvalue_reference; template struct add_rvalue_reference; template using remove_reference_t = typename remove_reference::type; template using add_lvalue_reference_t = typename add_lvalue_reference::type; template using add_rvalue_reference_t = typename add_rvalue_reference::type; // sign modifications template struct make_signed; template struct make_unsigned; template using make_signed_t = typename make_signed::type; template using make_unsigned_t = typename make_unsigned::type; // array modifications template struct remove_extent; template struct remove_all_extents; template using remove_extent_t = typename remove_extent::type; template using remove_all_extents_t = typename remove_all_extents::type; // pointer modifications template struct remove_pointer; template struct add_pointer; template using remove_pointer_t = typename remove_pointer::type; template using add_pointer_t = typename add_pointer::type; // other transformations template struct type_identity; // C++20 template struct aligned_storage; template struct aligned_union; template struct remove_cvref; // C++20 template struct decay; template struct enable_if; template struct conditional; template struct common_type; template class TQual, template class UQual> struct basic_common_reference {}; // C++20 template struct common_reference; // C++20 template struct underlying_type; template struct invoke_result; template struct unwrap_reference; template struct unwrap_ref_decay; template using type_identity_t = typename type_identity::type; template using aligned_storage_t = typename aligned_storage::type; template using aligned_union_t = typename aligned_union::type; template using remove_cvref_t = typename remove_cvref::type; // C++20 template using decay_t = typename decay::type; template using enable_if_t = typename enable_if::type; template using conditional_t = typename conditional::type; template using common_type_t = typename common_type::type; template using common_reference_t = typename common_reference::type; // C++20 template using underlying_type_t = typename underlying_type::type; template using invoke_result_t = typename invoke_result::type; template using unwrap_reference_t = typename unwrap_reference::type; template using unwrap_ref_decay_t = typename unwrap_ref_decay::type; template using void_t = void; // logical operator traits template struct conjunction; template struct disjunction; template struct negation; enum class endian { // C++20 little, big, native }; // primary type categories template constexpr bool is_void_v = is_void::value; template constexpr bool is_null_pointer_v = is_null_pointer::value; template constexpr bool is_integral_v = is_integral::value; template constexpr bool is_floating_point_v = is_floating_point::value; template constexpr bool is_array_v = is_array::value; template constexpr bool is_pointer_v = is_pointer::value; template constexpr bool is_lvalue_reference_v = is_lvalue_reference::value; template constexpr bool is_rvalue_reference_v = is_rvalue_reference::value; template constexpr bool is_member_object_pointer_v = is_member_object_pointer::value; template constexpr bool is_member_function_pointer_v = is_member_function_pointer::value; template constexpr bool is_enum_v = is_enum::value; template constexpr bool is_union_v = is_union::value; template constexpr bool is_class_v = is_class::value; template constexpr bool is_function_v = is_function::value; // composite type categories template constexpr bool is_reference_v = is_reference::value; template constexpr bool is_arithmetic_v = is_arithmetic::value; template constexpr bool is_fundamental_v = is_fundamental::value; template constexpr bool is_object_v = is_object::value; template constexpr bool is_scalar_v = is_scalar::value; template constexpr bool is_compound_v = is_compound::value; template constexpr bool is_member_pointer_v = is_member_pointer::value; // type properties template constexpr bool is_const_v = is_const::value; template constexpr bool is_volatile_v = is_volatile::value; template constexpr bool is_trivial_v = is_trivial::value; template constexpr bool is_trivially_copyable_v = is_trivially_copyable::value; template constexpr bool is_standard_layout_v = is_standard_layout::value; template [[deprecated]] constexpr bool is_pod_v = is_pod::value; // C++17 template constexpr bool is_empty_v = is_empty::value; template constexpr bool is_polymorphic_v = is_polymorphic::value; template constexpr bool is_abstract_v = is_abstract::value; template constexpr bool is_final_v = is_final::value; template constexpr bool is_aggregate_v = is_aggregate::value; template constexpr bool is_signed_v = is_signed::value; template constexpr bool is_unsigned_v = is_unsigned::value; template constexpr bool is_bounded_array_v = is_bounded_array::value; // C++20 template constexpr bool is_unbounded_array_v = is_unbounded_array::value; // C++20 template constexpr bool is_scoped_enum_v = is_scoped_enum::value; // C++23 template constexpr bool is_constructible_v = is_constructible::value; template constexpr bool is_default_constructible_v = is_default_constructible::value; template constexpr bool is_copy_constructible_v = is_copy_constructible::value; template constexpr bool is_move_constructible_v = is_move_constructible::value; template constexpr bool is_assignable_v = is_assignable::value; template constexpr bool is_copy_assignable_v = is_copy_assignable::value; template constexpr bool is_move_assignable_v = is_move_assignable::value; template constexpr bool is_swappable_with_v = is_swappable_with::value; template constexpr bool is_swappable_v = is_swappable::value; template constexpr bool is_destructible_v = is_destructible::value; template constexpr bool is_trivially_constructible_v = is_trivially_constructible::value; template constexpr bool is_trivially_default_constructible_v = is_trivially_default_constructible::value; template constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible::value; template constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible::value; template constexpr bool is_trivially_assignable_v = is_trivially_assignable::value; template constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable::value; template constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable::value; template constexpr bool is_trivially_destructible_v = is_trivially_destructible::value; template constexpr bool is_nothrow_constructible_v = is_nothrow_constructible::value; template constexpr bool is_nothrow_default_constructible_v = is_nothrow_default_constructible::value; template constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible::value; template constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible::value; template constexpr bool is_nothrow_assignable_v = is_nothrow_assignable::value; template constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable::value; template constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable::value; template constexpr bool is_nothrow_swappable_with_v = is_nothrow_swappable_with::value; template constexpr bool is_nothrow_swappable_v = is_nothrow_swappable::value; template constexpr bool is_nothrow_destructible_v = is_nothrow_destructible::value; template constexpr bool is_implicit_lifetime_v = is_implicit_lifetime::value; // C++23 template constexpr bool has_virtual_destructor_v = has_virtual_destructor::value; template constexpr bool has_unique_object_representations_v = has_unique_object_representations::value; template constexpr bool has_strong_structural_equality_v = has_strong_structural_equality::value; // C++20 template constexpr bool reference_constructs_from_temporary_v = reference_constructs_from_temporary::value; // C++23 template constexpr bool reference_converts_from_temporary_v = reference_converts_from_temporary::value; // C++23 // type property queries template constexpr size_t alignment_of_v = alignment_of::value; template constexpr size_t rank_v = rank::value; template constexpr size_t extent_v = extent::value; // type relations template constexpr bool is_same_v = is_same::value; template constexpr bool is_base_of_v = is_base_of::value; template constexpr bool is_convertible_v = is_convertible::value; template constexpr bool is_nothrow_convertible_v = is_nothrow_convertible::value; // C++20 template constexpr bool is_layout_compatible_v = is_layout_compatible::value; // C++20 template constexpr bool is_pointer_interconvertible_base_of_v = is_pointer_interconvertible_base_of::value; // C++20 template constexpr bool is_invocable_v = is_invocable::value; template constexpr bool is_invocable_r_v = is_invocable_r::value; template constexpr bool is_nothrow_invocable_v = is_nothrow_invocable::value; template constexpr bool is_nothrow_invocable_r_v = is_nothrow_invocable_r::value; // logical operator traits template constexpr bool conjunction_v = conjunction::value; template constexpr bool disjunction_v = disjunction::value; template constexpr bool negation_v = negation::value; // member relationships template constexpr bool is_pointer_interconvertible_with_class(M S::*m) noexcept; template constexpr bool is_corresponding_member(M1 S1::*m1, M2 S2::*m2) noexcept; // constant evaluation context constexpr bool is_constant_evaluated() noexcept; } #include namespace std { // Compile-time rational arithmetic template class ratio { static constexpr intmax_t num; static constexpr intmax_t den; using type = ratio; }; // ratio arithmetic template using ratio_add; template using ratio_subtract; template using ratio_multiply; template using ratio_divide; // ratio comparison template struct ratio_equal; template struct ratio_not_equal; template struct ratio_less; template struct ratio_less_equal; template struct ratio_greater; template struct ratio_greater_equal; template constexpr bool ratio_equal_v = ratio_equal::value; template constexpr bool ratio_not_equal_v = ratio_not_equal::value; template constexpr bool ratio_less_v = ratio_less::value; template constexpr bool ratio_less_equal_v = ratio_less_equal::value; template constexpr bool ratio_greater_v = ratio_greater::value; template constexpr bool ratio_greater_equal_v = ratio_greater_equal::value; // convenience SI typedefs using yocto; using zepto; using atto; using femto; using pico; using nano; using micro; using milli; using centi; using deci; using deca; using hecto; using kilo; using mega; using giga; using tera; using peta; using exa; using zetta; using yotta; using ronna; using quetta; } #include // C++17 #include // C++20 namespace std { // Primitive numeric conversions enum class chars_format { scientific , fixed, hex, general = fixed | scientific }; struct to_chars_result { char* ptr; error_code ec; }; to_chars_result to_chars(char* first, char* last, float value); struct from_chars_result { const char* ptr; error_code ec; }; from_chars_result from_chars(const char* first, const char* last, float& value, chars_format fmt = chars_format::general); } #include namespace std::chrono { // Time // class template duration template > class duration { using rep = Rep; using period = typename Period::type; constexpr rep count() const; static constexpr duration zero(); static constexpr duration min(); static constexpr duration max(); }; // class template time_point template class time_point { using clock = Clock; using duration = Duration; using rep = typename duration::rep; using period = typename duration::period; constexpr duration time_since_epoch() const; static constexpr time_point min(); static constexpr time_point max(); }; // customization traits template struct treat_as_floating_point; template struct duration_values { static constexpr Rep zero(); static constexpr Rep min(); static constexpr Rep max(); }; template constexpr bool treat_as_floating_point_v = treat_as_floating_point::value; template struct is_clock; // C++20 template constexpr bool is_clock_v = is_clock::value; // duration_cast template constexpr ToDuration duration_cast(const duration& d); template constexpr ToDuration floor(const duration& d); template constexpr ToDuration ceil(const duration& d); template constexpr ToDuration round(const duration& d); template basic_ostream& to_stream(basic_ostream& os, const charT* fmt, const duration& d); // C++20 template > basic_istream& from_stream(basic_istream& is, const charT* fmt,duration& d, basic_string* abbrev = nullptr, minutes* offset = nullptr); // C++20 // convenience typedefs using nanoseconds; using microseconds; using milliseconds; using seconds; using minutes; using hours; using days; // C++20 using weeks; // C++20 using years; // C++20 using months; // C++20 // time_point_cast template constexpr time_point time_point_cast(const time_point& t); template constexpr time_point floor(const time_point& tp); template constexpr time_point ceil(const time_point& tp); template constexpr time_point round(const time_point& tp); template constexpr duration abs(duration d); // clocks class system_clock { using time_point = chrono::time_point; static constexpr bool is_steady ; static time_point now() noexcept; static time_t to_time_t(const time_point& t) noexcept; static time_point from_time_t(time_t t) noexcept; }; template using sys_time = time_point; // C++20 using sys_seconds = sys_time; using sys_days = sys_time; class utc_clock { // C++20 template static sys_time> to_sys(const utc_time& t); template static utc_time> from_sys(const sys_time& t); }; template using utc_time = time_point; using utc_seconds = utc_time; class tai_clock { // C++20 template static utc_time> to_utc(const tai_time&) noexcept; template static tai_time> from_utc(const utc_time&) noexcept; }; struct leap_second_info { // C++20 bool is_leap_second; seconds elapsed; }; template leap_second_info get_leap_second_info(const utc_time& ut); template using tai_time = time_point; using tai_seconds = tai_time; class gps_clock; // C++20 template using gps_time = time_point; using gps_seconds = gps_time; using file_clock; // C++20 template using file_time = time_point; class steady_clock; class high_resolution_clock; // local time C++20 struct local_t {}; template using local_time = time_point; using local_seconds = local_time; using local_days = local_time; template struct clock_time_conversion; template auto clock_cast(const time_point& t); struct last_spec; class day; class month; class year; class weekday; class weekday_indexed; class weekday_last; class month_day; class month_day_last; class month_weekday; class month_weekday_last; class year_month; class year_month_day; class year_month_day_last; class year_month_weekday; class year_month_weekday_last; template class hh_mm_ss { static constexpr unsigned fractional_width; using precision; constexpr bool is_negative() const noexcept; constexpr chrono::hours hours() const noexcept; constexpr chrono::minutes minutes() const noexcept; constexpr chrono::seconds seconds() const noexcept; constexpr precision subseconds() const noexcept; constexpr precision to_duration() const noexcept; }; constexpr bool is_am(const hours& h) noexcept; constexpr bool is_pm(const hours& h) noexcept; constexpr hours make12(const hours& h) noexcept; constexpr hours make24(const hours& h, bool is_pm) noexcept; // time zone database struct tzdb { string version; vector zones; vector links; vector leaps; const time_zone* locate_zone(string_view tz_name) const; const time_zone* current_zone() const; }; class tzdb_list { class const_iterator; const tzdb& front() const noexcept; const_iterator erase_after(const_iterator p); }; const tzdb& get_tzdb(); tzdb_list& get_tzdb_list(); const time_zone* locate_zone(string_view tz_name); const time_zone* current_zone(); const tzdb& reload_tzdb(); string remote_version(); class nonexistent_local_time : public runtime_error {}; class ambiguous_local_time : public runtime_error {}; struct sys_info { sys_seconds begin; sys_seconds end; seconds offset; minutes save; string abbrev; }; struct local_info { static constexpr int unique = 0; static constexpr int nonexistent = 1; static constexpr int ambiguous = 2; int result; sys_info first; sys_info second; }; enum class choose {earliest, latest}; class time_zone { string_view name() const noexcept; template sys_info get_info(const sys_time& st) const; template local_info get_info(const local_time& tp) const; template sys_time> to_sys(const local_time& tp) const; template local_time> to_local(const sys_time& tp) const; }; template struct zoned_traits { static const time_zone* default_zone(); static const time_zone* locate_zone(string_view name); }; template class zoned_time { TimeZonePtr get_time_zone() const; local_time get_local_time() const; sys_time get_sys_time() const; sys_info get_info() const; }; using zoned_seconds = zoned_time; class leap { constexpr sys_seconds date() const noexcept; }; class link { string_view name() const noexcept; string_view target() const noexcept; }; template basic_string format(const charT* fmt, const Streamable& s); template parse(const basic_string& format, Parsable& tp); // calendrical constants constexpr last_spec last{}; constexpr weekday Sunday{0}; constexpr weekday Monday{1}; constexpr weekday Tuesday{2}; constexpr weekday Wednesday{3}; constexpr weekday Thursday{4}; constexpr weekday Friday{5}; constexpr weekday Saturday{6}; constexpr month January{1}; constexpr month February{2}; constexpr month March{3}; constexpr month April{4}; constexpr month May{5}; constexpr month June{6}; constexpr month July{7}; constexpr month August{8}; constexpr month September{9}; constexpr month October{10}; constexpr month November{11}; constexpr month December{12} } #include namespace std { // Class type_index class type_index { size_t hash_code() const noexcept; const char* name() const noexcept; }; } #include namespace std { // Execution policies template struct is_execution_policy; template constexpr bool is_execution_policy_v = is_execution_policy::value; namespace execution { class sequenced_policy; class parallel_policy; class parallel_unsequenced_policy; class unsequenced_policy; constexpr sequenced_policy seq; constexpr parallel_policy par; constexpr parallel_unsequenced_policy par_unseq; constexpr unsequenced_policy unseq; } } #include // C++20 namespace std { // Formatting template string format(string_view fmt, const Args&... args); string vformat(string_view fmt, format_args args); template Out format_to(Out out, string_view fmt, const Args&... args); template Out vformat_to(Out out, string_view fmt, format_args_t args); template struct format_to_n_result { Out out; iter_difference_t size; }; template format_to_n_result format_to_n(Out out, iter_difference_t n, string_view fmt, const Args&... args); template size_t formatted_size(string_view fmt, const Args&... args); template concept formattable; template struct formatter; template class basic_format_parse_context { constexpr void advance_to(const_iterator it); constexpr size_t next_arg_id(); constexpr void check_arg_id(size_t id); }; using format_parse_context = basic_format_parse_context; using wformat_parse_context = basic_format_parse_context; template class basic_format_context { template using formatter_type = formatter; basic_format_arg arg(size_t id) const; std::locale locale(); iterator out(); void advance_to(iterator it); }; using format_context = basic_format_context; using wformat_context = basic_format_context; enum class range_format {}; template constexpr format_kind; template class range_formatter { constexpr void set_separator(basic_string_view sep) noexcept; constexpr void set_brackets(basic_string_view opening, basic_string_view closing) noexcept; constexpr formatter& underlying() noexcept; parse(ParseContext& ctx); format(R&& r, FormatContext& ctx) const; }; template struct formatter; template class basic_format_arg { class handle; }; template visit_format_arg(Visitor&& vis, basic_format_arg arg); template format-arg-store make_format_args(const Args&... args); template format-arg-store make_wformat_args(const Args&... args); template class basic_format_args { basic_format_arg get(size_t i) const noexcept; }; using format_args = basic_format_args; using wformat_args = basic_format_args; template using format_args_t = basic_format_args>; class format_error : public runtime_error {}; } #include namespace std { // Strings template struct char_traits; template <> struct char_traits { using char_type = char; using int_type = int; using off_type = streamoff; using pos_type = streampos; using state_type = mbstate_t; using comparison_category = strong_ordering; // C++20 static constexpr void assign(char_type& c1, const char_type& c2) noexcept; static constexpr bool eq(char_type c1, char_type c2) noexcept; static constexpr bool lt(char_type c1, char_type c2) noexcept; static constexpr int compare(const char_type* s1, const char_type* s2, size_t n); static constexpr size_t length(const char_type* s); static constexpr const char_type* find(const char_type* s, size_t n, const char_type& a); static char_type* move(char_type* s1, const char_type* s2, size_t n); static char_type* copy(char_type* s1, const char_type* s2, size_t n); static char_type* assign(char_type* s, size_t n, char_type a); static constexpr int_type not_eof(int_type c) noexcept; static constexpr char_type to_char_type(int_type c) noexcept; static constexpr int_type to_int_type(char_type c) noexcept; static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; static constexpr int_type eof() noexcept; }; template <> struct char_traits { // C++20 using char_type = char8_t; using int_type = unsigned int; using off_type = streamoff; using pos_type = u8streampos; using state_type = mbstate_t; } template <> struct char_traits { using char_type = char16_t; using int_type = uint_least16_t; using off_type = streamoff; using pos_type = u16streampos; using state_type = mbstate_t; }; template <> struct char_traits { using char_type = char32_t; using int_type = uint_least32_t; using off_type = streamoff; using pos_type = u32streampos; using state_type = mbstate_t; }; template <> struct char_traits { using char_type = wchar_t; using int_type = wint_t; using off_type = streamoff; using pos_type = wstreampos; using state_type = mbstate_t; }; template basic_istream& getline(basic_istream& is, basic_string& str, charT delim); template void erase(basic_string& c, const U& value); // C++20 template void erase_if(basic_string& c, Predicate pred); // C++20 using string = basic_string; using u8string = basic_string; // C++20 using u16string = basic_string; using u32string = basic_string; using wstring = basic_string; int stoi(const string& str, size_t* idx = 0, int base = 10); long stol(const string& str, size_t* idx = 0, int base = 10); unsigned long stoul(const string& str, size_t* idx = 0, int base = 10); long long stoll(const string& str, size_t* idx = 0, int base = 10); unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10); float stof(const string& str, size_t* idx = 0); double stod(const string& str, size_t* idx = 0); long double stold(const string& str, size_t* idx = 0); string to_string(int val); wstring to_wstring(int val); template , class Allocator = allocator> class basic_string { using traits_type = traits; using value_type = charT; using allocator_type = Allocator; using size_type = typename allocator_traits::size_type; using difference_type = typename allocator_traits::difference_type; using pointer = typename allocator_traits::pointer; using const_pointer = typename allocator_traits::const_pointer; using reference = value_type&; using const_reference = const value_type&; using iterator; using const_iterator; using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; static const size_type npos = -1; iterator begin() noexcept; const_iterator begin() const noexcept; iterator end() noexcept; const_iterator end() const noexcept; reverse_iterator rbegin() noexcept; const_reverse_iterator rbegin() const noexcept; reverse_iterator rend() noexcept; const_reverse_iterator rend() const noexcept; const_iterator cbegin() const noexcept; const_iterator cend() const noexcept; const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crend() const noexcept; size_type size() const noexcept; size_type length() const noexcept; size_type max_size() const noexcept; void resize(size_type n, charT c); void resize(size_type n); template constexpr void resize_and_overwrite(size_type n, Operation op); // C++23 size_type capacity() const noexcept; void reserve(size_type res_arg = 0); void shrink_to_fit(); void clear() noexcept; [[nodiscard]] bool empty() const noexcept; const_reference operator[](size_type pos) const; reference operator[](size_type pos); const_reference at(size_type n) const; reference at(size_type n); const charT& front() const; charT& front(); const charT& back() const; charT& back(); basic_string& append(const charT* s); void push_back(charT c); basic_string& assign(const basic_string& str); basic_string& insert(size_type pos, const basic_string& str); basic_string& erase(size_type pos = 0, size_type n = npos) void pop_back(); basic_string& replace(size_type pos1, size_type n1, const basic_string& str); size_type copy(charT* s, size_type n, size_type pos = 0) const; void swap(basic_string& str) noexcept; const charT* c_str() const noexcept; const charT* data() const noexcept; constexpr allocator_type get_allocator() const noexcept; size_type find(basic_string_view sv, size_type pos = 0) const noexcept; size_type rfind(basic_string_view sv, size_type pos = npos) const noexcept; size_type find_first_of(basic_string_view sv, size_type pos = 0) const noexcept; size_type find_last_of(basic_string_view sv, size_type pos = npos) const noexcept; size_type find_first_not_of(basic_string_view sv, size_type pos = 0) const noexcept; size_type find_last_not_of(basic_string_view sv, size_type pos = npos) const noexcept; basic_string substr(size_type pos = 0, size_type n = npos) const; int compare(basic_string_view sv) const noexcept; bool starts_with(basic_string_view x) const noexcept; // C++20 bool ends_with(basic_string_view x) const noexcept; // C++20 bool contains(basic_string_view x) const noexcept; // C++23 }; } #include namespace std { // String view using string_view = basic_string_view; using u8string_view = basic_string_view; // C++20 using u16string_view = basic_string_view; using u32string_view = basic_string_view; using wstring_view = basic_string_view; template > class basic_string_view { constexpr void remove_prefix(size_type n); constexpr void remove_suffix(size_type n); size_type copy(charT* s, size_type n, size_type pos = 0) const; }; } #include #include namespace std { // Localization class locale { class facet; class id; using category = int; static const category none, collate, ctype, monetary, numeric, time, messages, all = collate | ctype | monetary | numeric | time | messages; basic_string name() const; static locale global(const locale&); static const locale& classic(); }; template const Facet& use_facet(const locale&); template bool has_facet(const locale&) noexcept; // ctype class ctype_base { using mask = T; static const mask space; static const mask print; static const mask cntrl; static const mask upper; static const mask lower; static const mask alpha; static const mask digit; static const mask punct; static const mask xdigit; static const mask blank; static const mask alnum = alpha | digit; static const mask graph = alnum | punct; }; template class ctype : public locale::facet, public ctype_base { using char_type = charT; bool is(mask m, charT c) const; const charT* is(const charT* low, const charT* high, mask* vec) const; const charT* scan_is(mask m, const charT* low, const charT* high) const; const charT* scan_not(mask m, const charT* low, const charT* high) const; charT toupper(charT c) const; const charT* toupper(charT* low, const charT* high) const; charT tolower(charT c) const; const charT* tolower(charT* low, const charT* high) const; charT widen(char c) const; const char* widen(const char* low, const char* high, charT* to) const; char narrow(charT c, char dfault) const; const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const; static locale::id id; }; template <> class ctype : public locale::facet, public ctype_base {}; template class ctype_byname : public ctype {}; class codecvt_base { enum result { ok, partial, error, noconv }; }; template class codecvt : public locale::facet, public codecvt_base { using intern_type = internT; using extern_type = externT; using state_type = stateT; result out(stateT& state, const internT* from, const internT* from_end, const internT*& from_next, externT* to, externT* to_end, externT*& to_next) const; result unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const; result in(stateT& state, const externT* from, const externT* from_end, const externT*& from_next, internT* to, internT* to_end, internT*& to_next) const; int encoding() const noexcept; bool always_noconv() const noexcept; int length(stateT&, const externT* from, const externT* end, size_t max) const; int max_length() const noexcept; static locale::id id; }; template class codecvt_byname : public codecvt {}; // deprecated C++14 code conversion facets enum codecvt_mode { // C++14 consume_header, generate_header, little_endian }; template class codecvt_utf8 : public codecvt {}; // C++14 template class codecvt_utf16 : public codecvt {}; // C++14 template class codecvt_utf8_utf16 : public codecvt {}; // C++14 template , class Byte_alloc = allocator> class wstring_convert { // C++14 wide_string from_bytes(char byte); byte_string to_bytes(Elem wchar); size_t converted() const noexcept; state_type state() const; }; template > class wbuffer_convert; // C++14 // numeric template > class num_get : public locale::facet { using char_type = charT; using iter_type = InputIterator; iter_type get(iter_type in, iter_type end, ios_base&, ios_base::iostate& err, bool& v) const; static locale::id id; }; template > class num_put : public locale::facet { using char_type = charT; using iter_type = OutputIterator; iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const; static locale::id id; }; template class numpunct : public locale::facet { using char_type = charT; using string_type = basic_string; char_type decimal_point() const; char_type thousands_sep() const; string grouping() const; string_type truename() const; string_type falsename() const; static locale::id id; }; template class numpunct_byname : public numpunct {}; // collation template class collate : public locale::facet { using char_type = charT; using string_type = basic_string; int compare(const charT* low1, const charT* high1, const charT* low2, const charT* high2) const; string_type transform(const charT* low, const charT* high) const; long hash(const charT* low, const charT* high) const; static locale::id id; }; template class collate_byname : public collate {}; // date and time class time_base { enum dateorder { no_order, dmy, mdy, ymd, ydm }; }; template > class time_get : public locale::facet { using char_type = charT; using iter_type = InputIterator; dateorder date_order() const { return do_date_order(); } iter_type get_time(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t) const; iter_type get_date(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t) const; iter_type get_weekday(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t) const; iter_type get_monthname(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t) const; iter_type get_year(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t) const; iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err, tm* t, char format, char modifier = 0) const; static locale::id id; }; template > class time_get_byname : public time_get {}; template > class time_put : public locale::facet { using char_type = charT; using iter_type = OutputIterator; iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb, const charT* pattern, const charT* pat_end) const; static locale::id id; }; template > class time_put_byname : public time_put {}; // money class money_base { enum part { none, space, symbol, sign, value }; struct pattern { char field[4]; }; }; template > class money_get : public locale::facet { using char_type = charT; using iter_type = InputIterator; using string_type = basic_string; iter_type get(iter_type s, iter_type end, bool intl, ios_base& f, ios_base::iostate& err, long double& units) const; static locale::id id; }; template > class money_put { using char_type = charT; using iter_type = OutputIterator; using string_type = basic_string; iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double units) const; static locale::id id; }; template class moneypunct : public locale::facet, public money_base { using char_type = charT; using string_type = basic_string; charT decimal_point() const; charT thousands_sep() const; string grouping() const; string_type curr_symbol() const; string_type positive_sign() const; string_type negative_sign() const; int frac_digits() const; pattern pos_format() const; pattern neg_format() const; static locale::id id; static const bool intl = International; }; template class moneypunct_byname : public moneypunct { using pattern = money_base::pattern; using string_type = basic_string; }; // message retrieval class messages_base { using catalog; }; template class messages : public locale::facet, public messages_base { using char_type = charT; using string_type = basic_string; catalog open(const basic_string& fn, const locale&) const; string_type get(catalog c, int set, int msgid, const string_type& dfault) const; void close(catalog c) const; static locale::id id; }; template class messages_byname : public messages { using catalog = messages_base::catalog; using string_type = basic_string; }; } #include #include #include #include #include namespace std { // Sequence containers template struct array { using value_type = T; using pointer = T*; using const_pointer = const T*; using reference = T&; using const_reference = const T&; using size_type = size_t; using difference_type = ptrdiff_t; using iterator; using const_iterator; using reverse_iterator = std::reverse_iterator; using const_reverse_iterator = std::reverse_iterator; void fill(const T& u); void swap(array&) noexcept(is_nothrow_swappable_v); // iterators constexpr iterator begin() noexcept; constexpr const_iterator begin() const noexcept; constexpr iterator end() noexcept; constexpr const_iterator end() const noexcept; constexpr reverse_iterator rbegin() noexcept; constexpr const_reverse_iterator rbegin() const noexcept; constexpr reverse_iterator rend() noexcept; constexpr const_reverse_iterator rend() const noexcept; constexpr const_iterator cbegin() const noexcept; constexpr const_iterator cend() const noexcept; constexpr const_reverse_iterator crbegin() const noexcept; constexpr const_reverse_iterator crend() const noexcept; // capacity [[nodiscard]] constexpr bool empty() const noexcept; constexpr size_type size() const noexcept; constexpr size_type max_size() const noexcept; // element access constexpr reference operator[](size_type n); constexpr const_reference operator[](size_type n) const; constexpr reference at(size_type n); constexpr const_reference at(size_type n) const; constexpr reference front(); constexpr const_reference front() const; constexpr reference back(); constexpr const_reference back() const; constexpr T * data() noexcept; constexpr const T * data() const noexcept; }; template constexpr array, N> to_array(T (&a)[N]); // C++20 template constexpr T& get(array&) noexcept; // C++20 template > class deque { using allocator_type = Allocator; template void assign(initializer_list); allocator_type get_allocator() const noexcept; // capacity void resize(size_type sz, const T& c); void shrink_to_fit(); // modifiers template reference emplace_front(Args&&... args); template reference emplace_back(Args&&... args); template iterator emplace(const_iterator position, Args&&... args); void push_front(const T& x); void push_back(const T& x); template R> void append_range(R&& rg); iterator insert(const_iterator position, const T& x); void pop_front(); void pop_back(); iterator erase(const_iterator position); void swap(deque&) noexcept(allocator_traits::is_always_equal::value); void clear() noexcept; }; template > class forward_list { iterator before_begin() noexcept; const_iterator cbefore_begin() const noexcept; // modifiers template reference emplace_front(Args&&... args); template iterator emplace_after(const_iterator position, Args&&... args); iterator insert_after(const_iterator position, const T& x); template R> iterator insert_range_after(const_iterator position, R&& rg); iterator erase_after(const_iterator position); // forward_list operations void splice_after(const_iterator position, forward_list& x); void remove(const T& value); template void remove_if(Predicate pred); void unique(); void merge(forward_list& x); void sort(); template void sort(Compare comp); void reverse() noexcept; }; template > class list { // list operations void splice(const_iterator position, list& x); }; template > class vector; template class vector { class reference { void flip() noexcept; }; void flip() noexcept; }; namespace pmr { template using deque = std::deque>; template using forward_list = std::forward_list>; template using list = std::list>; template using vector = std::vector>; } } #include #include namespace std { // Associative containers template , class Allocator = allocator>> class map { using key_type = Key; using mapped_type = T; using key_compare = Compare; using node_type; using insert_return_type; class value_compare {}; template iterator emplace_hint(const_iterator position, Args&&... args); node_type extract(const_iterator position); template pair try_emplace(const key_type& k, Args&&... args); template pair insert_or_assign(const key_type& k, M&& obj); key_compare key_comp() const; value_compare value_comp() const; iterator find(const key_type& x); size_type count(const key_type& x) const; bool contains(const key_type& x) const; // C++20 template size_type count(const K& x) const; iterator lower_bound(const key_type& x); iterator upper_bound(const key_type& x); pair equal_range(const key_type& x); }; template , class Allocator = allocator>> class multimap; namespace pmr { template > using map = std::map>>; template > using multimap = std::multimap>>; } template , class Allocator = allocator> class set; template , class Allocator = allocator> class multiset; namespace pmr { template > using set = std::set>; template > using multiset = std::multiset>; } } #include #include namespace std { // Unordered associative containers template , class Pred = equal_to, class Alloc = allocator>> class unordered_map { using hasher = Hash; using key_equal = Pred; using local_iterator; using const_local_iterator; hasher hash_function() const; key_equal key_eq() const; // bucket interface size_type bucket_count() const noexcept; size_type max_bucket_count() const noexcept; size_type bucket_size(size_type n) const; size_type bucket(const key_type& k) const; // hash policy float load_factor() const noexcept; float max_load_factor() const noexcept; void max_load_factor(float z); void rehash(size_type n); void reserve(size_type n); }; template , class Pred = equal_to, class Alloc = allocator>> class unordered_multimap; namespace pmr { template , class Pred = equal_to> using unordered_map = std::unordered_map>>; template , class Pred = equal_to> using unordered_multimap = std::unordered_multimap>>; } template , class Pred = equal_to, class Alloc = allocator> class unordered_set; template , class Pred = equal_to, class Alloc = allocator> class unordered_multiset; namespace pmr { template , class Pred = equal_to> using unordered_set = std::unordered_set>; template , class Pred = equal_to> using unordered_multiset = std::unordered_multiset>; } } #include #include #include // C++23 #include // C++23 namespace std { // Container adaptors template > class queue { using container_type = Container; void push(const value_type& x); void pop(); }; template , class Compare = less> class priority_queue; template > class stack { reference top(); }; template , class KeyContainer = vector, class MappedContainer = vector> class flat_map { using key_container_type = KeyContainer; using mapped_container_type = MappedContainer; }; struct sorted_unique_t { explicit sorted_unique_t() = default; }; constexpr sorted_unique_t sorted_unique{}; template , class KeyContainer = vector, class MappedContainer = vector> class flat_multimap; struct sorted_equivalent_t { explicit sorted_equivalent_t() = default; }; constexpr sorted_equivalent_t sorted_equivalent{}; template , class KeyContainer = vector> class flat_set; template , class KeyContainer = vector> class flat_multiset; } #include // C++20 namespace std { // Views constexpr size_t dynamic_extent = numeric_limits::max(); template class span { static constexpr index_type extent = Extent; constexpr index_type size_bytes() const noexcept; }; template span as_bytes(span s) noexcept; template span as_writable_bytes(span s) noexcept; } #include // C++23 namespace std { // Multidimensional access template class extents { using index_type = IndexType; using size_type = make_unsigned_t; using rank_type = size_t; static constexpr rank_type rank() noexcep; static constexpr rank_type rank_dynamic() noexcept; static constexpr size_t static_extent(rank_type) noexcept; constexpr index_type extent(rank_type) const noexcept; }; template using dextents; struct layout_left { template class mapping { using extents_type = Extents; using index_type = typename extents_type::index_type; using size_type = typename extents_type::size_type; using rank_type = typename extents_type::rank_type; using layout_type = layout_left; constexpr const extents_type& extents() const noexcept; constexpr index_type required_span_size() const noexcept; static constexpr bool is_always_unique() noexcept; static constexpr bool is_always_exhaustive() noexcept; static constexpr bool is_always_strided() noexcept; static constexpr bool is_unique() noexcept; static constexpr bool is_exhaustive() noexcept; static constexpr bool is_strided() noexcept; constexpr index_type stride(rank_type) const noexcept; }; }; struct layout_right; struct layout_stride; template class default_accessor { using offset_policy = default_accessor; using element_type = ElementType; using reference = ElementType&; using data_handle_type = ElementType*; constexpr reference access(data_handle_type p, size_t i) const noexcept; constexpr data_handle_type offset(data_handle_type p, size_t i) const noexcept; }; template > class mdspan { using accessor_type = AccessorPolicy; using mapping_type = typename layout_type::template mapping; constexpr const data_handle_type& data_handle() const noexcept; constexpr const mapping_type& mapping() const noexcept; constexpr const accessor_type& accessor() const noexcept; }; } #include namespace std { // Iterators template struct incrementable_traits; // C++20 template using iter_difference_t; template struct indirectly_readable_traits; // C++20 template using iter_value_t; // primitives template struct iterator_traits; template struct iterator_traits { using difference_type = ptrdiff_t; using value_type = T; using pointer = T*; using reference = T&; using iterator_category = random_access_iterator_tag; }; template using iter_reference_t = decltype(*declval()); // C++20 using iter_rvalue_reference_t = decltype(ranges::iter_move(declval())); // iterator concepts template concept indirectly_readable; template using iter_common_reference_t = common_reference_t, iter_value_t&>; template concept indirectly_writable; template concept weakly_incrementable; template concept incrementable; template concept input_or_output_iterator; template concept sentinel_for; template concept sized_sentinel_for; template constexpr bool disable_sized_sentinel = false; template concept input_iterator; template concept output_iterator; template concept forward_iterator; template concept bidirectional_iterator; template concept random_access_iterator; template concept contiguous_iterator; // indirect callable requirements template concept indirectly_unary_invocable; template concept indirectly_regular_unary_invocable; template concept indirectly_unary_predicate; template concept indirect_binary_predicate; template concept indirect_equivalence_relation; template concept indirect_strict_weak_order; template using indirect_result_t = invoke_result_t...>; template Proj> struct projected; template struct incrementable_traits>; // common algorithm requirements template concept indirectly_movable; template concept indirectly_movable_storable; template concept indirectly_copyable; template concept indirectly_copyable_storable; template concept indirectly_swappable; template concept indirectly_comparable; template concept permutable; template concept mergeable; template concept sortable; // primitives struct input_iterator_tag {}; struct output_iterator_tag {}; struct forward_iterator_tag: public input_iterator_tag {}; struct bidirectional_iterator_tag: public forward_iterator_tag {}; struct random_access_iterator_tag: public bidirectional_iterator_tag {}; struct contiguous_iterator_tag: public random_access_iterator_tag {}; // C++20 // iterator operations template constexpr void advance(InputIterator& i, Distance n); template constexpr typename iterator_traits::difference_type distance(InputIterator first, InputIterator last); template constexpr InputIterator next(InputIterator x, typename iterator_traits::difference_type n = 1); template constexpr BidirectionalIterator prev(BidirectionalIterator x, typename iterator_traits::difference_type n = 1); // predefined iterators template class reverse_iterator { constexpr Iterator base() const; iter_move(const reverse_iterator& i); // C++20 iter_swap(const reverse_iterator& x, const reverse_iterator& y); // C++20 }; template constexpr reverse_iterator make_reverse_iterator(Iterator i); template class back_insert_iterator; template back_insert_iterator back_inserter(Container& x); template class front_insert_iterator; template front_insert_iterator front_inserter(Container& x); template class insert_iterator; template insert_iterator inserter(Container& x, typename Container::iterator i); // constant iterators and sentinels template using iter_const_reference_t; template using const_iterator; template using const_sentinel; template class basic_const_iterator; template constexpr const_iterator make_const_iterator(I it) { return it; } template class move_iterator; template constexpr move_iterator make_move_iterator(Iterator i); template class move_sentinel; // C++20 template S> class common_iterator; // C++20 template struct incrementable_traits>; template struct iterator_traits>; struct default_sentinel_t; constexpr default_sentinel_t default_sentinel{}; template class counted_iterator; // C++20 template struct incrementable_traits>; template struct iterator_traits>; struct unreachable_sentinel_t; // C++20 constexpr unreachable_sentinel_t unreachable_sentinel{}; // stream iterators template , class Distance = ptrdiff_t> class istream_iterator { using traits_type = traits; using istream_type = basic_istream; }; template > class ostream_iterator { using ostream_type = basic_ostream; }; template > class istreambuf_iterator { using streambuf_type = basic_streambuf; using istream_type = basic_istream; }; template > class ostreambuf_iterator { using ostream_type = basic_ostream; }; template constexpr ptrdiff_t ssize(const T (&array)[N]) noexcept; // C++20 } #include // C++20 namespace std::ranges { // Ranges template concept range; template constexpr bool enable_borrowed_range = false; template concept borrowed_range; template using iterator_t = decltype(ranges::begin(declval())); template using const_iterator_t = const_iterator>; template using sentinel_t = decltype(ranges::end(declval())); template using range_difference_t = iter_difference_t>; template using range_size_t = decltype(ranges::size(declval())); template using range_value_t = iter_value_t>; template using range_reference_t = iter_reference_t>; template using range_const_reference_t = iter_const_reference_t>; template using range_rvalue_reference_t = iter_rvalue_reference_t>; template using range_common_reference_t = iter_common_reference_t>; template constexpr bool disable_sized_range = false; template concept sized_range; template constexpr bool enable_view; struct view_base {}; template concept view; // other range refinements template concept output_range; template concept input_range; template concept forward_range; template concept bidirectional_range; template concept random_access_range; template concept contiguous_range; template concept common_range; template concept viewable_range; template concept constant_range; template class view_interface : public view_base {}; enum class subrange_kind : bool { unsized, sized }; template S = I, subrange_kind K> class subrange : public view_interface> {}; struct dangling; template > struct elements_of; template using borrowed_iterator_t = conditional_t, iterator_t, dangling>; template using borrowed_subrange_t = conditional_t, subrange>, dangling>; template