diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-12-01 18:52:05 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-12-01 18:52:05 +0100 |
commit | 0c991ef1d567cf87d7be6ab219b70767809b6397 (patch) | |
tree | 1920bac137bb5022a3cb55d632ada629f116d988 /c++ | |
parent | aacda7e79342e3dfacd92da834703235f9b17396 (diff) |
core: Fixed constexpr string_literal sum
Diffstat (limited to 'c++')
-rw-r--r-- | c++/core/string_literal.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/c++/core/string_literal.h b/c++/core/string_literal.h index 30f62fd..ccc8f49 100644 --- a/c++/core/string_literal.h +++ b/c++/core/string_literal.h @@ -38,12 +38,12 @@ public: constexpr string_literal<CharT, N+NR-1> operator+(const string_literal<CharT, NR>& rhs) const noexcept { CharT sum[N+NR-1]; - // The weird +1 happen due to needing to skip the '\0' terminator + // The weird i+1 happens due to needing to skip the '\0' terminator for(size_t i = 0; (i+1) < N; ++i){ sum[i] = data[i]; } - for(size_t i = N; (i+1) < (N+NR); ++i){ - sum[i+1] = rhs.data[i+1]; + for(size_t i = 0; i < NR; ++i){ + sum[i+N-1] = rhs.data[i]; } return string_literal<CharT, N+NR-1>{sum}; |