diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -38,10 +38,13 @@ New Features ------------ -- There's initial support for the C++20 header ````. The implementation - is incomplete. Some functions are known to be inefficient; both in memory - usage and performance. The implementation is considered experimental and isn't - considered ABI stable. +- There's support for the C++20 header ````. Some parts are still + missing, most notably the compile-time format string validation. Some + functions are known to be inefficient, both in memory usage and performance. + The implementation isn't API- or ABI-stable and therefore considered + experimental. (Some not-yet-implemented papers require an API-break.) + Vendors can still disable this header by turning the CMake option + `LIBCXX_ENABLE_INCOMPLETE_FEATURES` off. - There's a new CMake option ``LIBCXX_ENABLE_UNICODE`` to disable Unicode support in the ```` header. This only affects the estimation of the diff --git a/libcxx/docs/Status/Cxx20.rst b/libcxx/docs/Status/Cxx20.rst --- a/libcxx/docs/Status/Cxx20.rst +++ b/libcxx/docs/Status/Cxx20.rst @@ -41,6 +41,7 @@ .. note:: .. [#note-P0600] P0600: The missing bits in P0600 are in |sect|\ [mem.res.class] and |sect|\ [mem.poly.allocator.class]. + .. [#note-P0645] P0645: The paper is implemented but still marked as an incomplete feature. Not yet implemented LWG-issues will cause API and ABI breakage. .. [#note-P0966] P0966: It was previously erroneously marked as complete in version 8.0. See `bug 45368 `__. .. [#note-P0619] P0619: Only sections D.8, D.9, D.10 and D.13 are implemented. Sections D.4, D.7, D.11, D.12, and D.14 remain undone. .. [#note-P0883] P0883: shared_ptr and floating-point changes weren't applied as they themselves aren't implemented yet. diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -103,7 +103,7 @@ "`P0466R5 `__","LWG","Layout-compatibility and Pointer-interconvertibility Traits","Cologne","","" "`P0553R4 `__","LWG","Bit operations","Cologne","|Complete|","9.0" "`P0631R8 `__","LWG","Math Constants","Cologne","|Complete|","11.0" -"`P0645R10 `__","LWG","Text Formatting","Cologne","|In Progress|","" +"`P0645R10 `__","LWG","Text Formatting","Cologne","|Complete| [#note-P0645]_","14.0" "`P0660R10 `__","LWG","Stop Token and Joining Thread, Rev 10","Cologne","","" "`P0784R7 `__","CWG","More constexpr containers","Cologne","|Complete|","12.0" "`P0980R1 `__","LWG","Making std::string constexpr","Cologne","","" diff --git a/libcxx/docs/Status/FormatIssues.csv b/libcxx/docs/Status/FormatIssues.csv --- a/libcxx/docs/Status/FormatIssues.csv +++ b/libcxx/docs/Status/FormatIssues.csv @@ -1,5 +1,5 @@ Number,Name,Assignee,Patch,Status,First released version -`P0645 `_,"Text Formatting",Mark de Wever,,|Partial|, +`P0645 `_,"Text Formatting",Mark de Wever,,|Complete|,Clang 14 `P1652 `_,"Printf corner cases in std::format",Mark de Wever,"`D103433 `__, `D114001 `__",|Review|, `P1892 `_,"Extended locale-specific presentation specifiers for std::format",Mark de Wever,`D103368 `__,|Complete|,Clang 14 `P1868 `_,"width: clarifying units of width and precision in std::format (Implements the unicode support.)",Mark de Wever,"`D103413 `__ `D103425 `__ `D103670 `__",|Complete|,Clang 14 diff --git a/libcxx/include/format b/libcxx/include/format --- a/libcxx/include/format +++ b/libcxx/include/format @@ -14,43 +14,15 @@ namespace std { // [format.context], class template basic_format_context - template - class basic_format_context { - basic_format_args args_; // exposition only - Out out_; // exposition only - - public: - using iterator = Out; - using char_type = charT; - template using formatter_type = formatter; - - basic_format_arg arg(size_t id) const; - std::locale locale(); - - iterator out(); - void advance_to(iterator it); - }; + template class basic_format_context; using format_context = basic_format_context; using wformat_context = basic_format_context; // [format.args], class template basic_format_args - template - class basic_format_args { - size_t size_; // exposition only - const basic_format_arg* data_; // exposition only - - public: - basic_format_args() noexcept; - - template - basic_format_args(const format-arg-store& store) noexcept; - - basic_format_arg get(size_t i) const noexcept; - }; + template class basic_format_args; using format_args = basic_format_args; using wformat_args = basic_format_args; - // [format.functions], formatting functions template string format(string_view fmt, const Args&... args); @@ -90,8 +62,7 @@ Out out; iter_difference_t size; }; - - template + template format_to_n_result format_to_n(Out out, iter_difference_t n, string_view fmt, const Args&... args); template @@ -116,99 +87,22 @@ size_t formatted_size(const locale& loc, wstring_view fmt, const Args&... args); // [format.formatter], formatter - template<> struct formatter; - template<> struct formatter; - template<> struct formatter; - - template<> struct formatter; - template<> struct formatter; - template struct formatter; - template - struct formatter, charT>; - template - struct formatter, charT>; + template struct formatter; // [format.parse.ctx], class template basic_format_parse_context - template - class basic_format_parse_context { - public: - using char_type = charT; - using const_iterator = typename basic_string_view::const_iterator; - using iterator = const_iterator; - - private: - iterator begin_; // exposition only - iterator end_; // exposition only - enum indexing { unknown, manual, automatic }; // exposition only - indexing indexing_; // exposition only - size_t next_arg_id_; // exposition only - size_t num_args_; // exposition only - - public: - constexpr explicit basic_format_parse_context(basic_string_view fmt, - size_t num_args = 0) noexcept; - basic_format_parse_context(const basic_format_parse_context&) = delete; - basic_format_parse_context& operator=(const basic_format_parse_context&) = delete; - - constexpr const_iterator begin() const noexcept; - constexpr const_iterator end() const noexcept; - constexpr void advance_to(const_iterator it); - - constexpr size_t next_arg_id(); - constexpr void check_arg_id(size_t id); - }; + template class basic_format_parse_context; using format_parse_context = basic_format_parse_context; using wformat_parse_context = basic_format_parse_context; // [format.arguments], arguments // [format.arg], class template basic_format_arg - template - class basic_format_arg { - public: - class handle; - - private: - using char_type = typename Context::char_type; // exposition only - - variant, - const void*, handle> value; // exposition only - - template explicit basic_format_arg(const T& v) noexcept; // exposition only - explicit basic_format_arg(float n) noexcept; // exposition only - explicit basic_format_arg(double n) noexcept; // exposition only - explicit basic_format_arg(long double n) noexcept; // exposition only - explicit basic_format_arg(const char_type* s); // exposition only - - template - explicit basic_format_arg( - basic_string_view s) noexcept; // exposition only - - template - explicit basic_format_arg( - const basic_string& s) noexcept; // exposition only - - explicit basic_format_arg(nullptr_t) noexcept; // exposition only - - template - explicit basic_format_arg(const T* p) noexcept; // exposition only - - public: - basic_format_arg() noexcept; - - explicit operator bool() const noexcept; - }; + template class basic_format_arg; template see below visit_format_arg(Visitor&& vis, basic_format_arg arg); // [format.arg.store], class template format-arg-store - template - struct format-arg-store { // exposition only - array, sizeof...(Args)> args; - }; + template struct format-arg-store; // exposition only template format-arg-store @@ -218,43 +112,7 @@ make_wformat_args(const Args&... args); // [format.error], class format_error - class format_error : public runtime_error { - public: - explicit format_error(const string& what_arg); - explicit format_error(const char* what_arg); - }; - - // [format.parse.ctx], class template basic_format_parse_context - template - class basic_format_parse_context { - public: - using char_type = charT; - using const_iterator = typename basic_string_view::const_iterator; - using iterator = const_iterator; - - private: - iterator begin_; // exposition only - iterator end_; // exposition only - enum indexing { unknown, manual, automatic }; // exposition only - indexing indexing_; // exposition only - size_t next_arg_id_; // exposition only - size_t num_args_; // exposition only - - public: - constexpr explicit basic_format_parse_context(basic_string_view fmt, - size_t num_args = 0) noexcept; - basic_format_parse_context(const basic_format_parse_context&) = delete; - basic_format_parse_context& operator=(const basic_format_parse_context&) = delete; - - constexpr const_iterator begin() const noexcept; - constexpr const_iterator end() const noexcept; - 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; + class format_error; } */