diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-10-19 13:21:20 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-10-19 17:16:29 +0200 |
commit | e6ca379bcbe7d9fb426cf8944f24e345e8856d3f (patch) | |
tree | 436bcc35620174f2a44ead359b1e8cae7f7b0056 /include/rtl | |
parent | 7cb283cf0e92cba4bd53b1cd69816ac7037937e4 (diff) |
Clean up some C++20 TODOs
Change-Id: I8baece4349683c7a83a283b85e24f33874b47ba3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158177
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/rtl')
-rw-r--r-- | include/rtl/string.hxx | 13 | ||||
-rw-r--r-- | include/rtl/ustring.hxx | 7 |
2 files changed, 6 insertions, 14 deletions
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index 62bf0530e819..55b83d675d8d 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -36,6 +36,7 @@ #include <string.h> #if defined LIBO_INTERNAL_ONLY +#include <algorithm> #include <string_view> #include <type_traits> #endif @@ -98,10 +99,7 @@ public: OStringLiteral(char const (&literal)[N]) { assertLayout(); assert(literal[N - 1] == '\0'); - //TODO: Use C++20 constexpr std::copy_n (P0202R3): - for (std::size_t i = 0; i != N; ++i) { - more.buffer[i] = literal[i]; - } + std::copy_n(literal, N, more.buffer); } #if !(defined _MSC_VER && _MSC_VER >= 1930 && _MSC_VER <= 1938 && defined _MANAGED) @@ -113,10 +111,7 @@ public: OStringLiteral(char8_t const (&literal)[N]) { assertLayout(); assert(literal[N - 1] == '\0'); - //TODO: Use C++20 constexpr std::copy_n (P0202R3): - for (std::size_t i = 0; i != N; ++i) { - more.buffer[i] = literal[i]; - } + std::copy_n(literal, N, more.buffer); } #endif @@ -141,7 +136,7 @@ private: oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx) sal_Int32 length = N - 1; - char buffer[N] = {}; //TODO: drop initialization for C++20 (P1331R2) + char buffer[N]; }; public: diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index cd23f121e2ac..cad8cc10ac48 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -96,10 +96,7 @@ public: OUStringLiteral(char16_t const (&literal)[N]) { assertLayout(); assert(literal[N - 1] == '\0'); - //TODO: Use C++20 constexpr std::copy_n (P0202R3): - for (std::size_t i = 0; i != N; ++i) { - more.buffer[i] = literal[i]; - } + std::copy_n(literal, N, more.buffer); } constexpr sal_Int32 getLength() const { return more.length; } @@ -123,7 +120,7 @@ private: oslInterlockedCount refCount = 0x40000000; // SAL_STRING_STATIC_FLAG (sal/rtl/strimp.hxx) sal_Int32 length = N - 1; - sal_Unicode buffer[N] = {}; //TODO: drop initialization for C++20 (P1331R2) + sal_Unicode buffer[N]; }; public: |