diff options
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: |