diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 09:49:47 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-18 09:49:47 +0100 |
| commit | 34ffda2f0cc9d884f3f6062d4a264db5ba76180a (patch) | |
| tree | 608d04e8e3ab1947b048535601149769376a9eac /dev/lib/core/chunk_string.hpp | |
| parent | 226bf12ca084705f47ed6aa66932f5efb4a7796b (diff) | |
feat: chunk_string: class` performance improvements. and new operator
overload.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/lib/core/chunk_string.hpp')
| -rw-r--r-- | dev/lib/core/chunk_string.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dev/lib/core/chunk_string.hpp b/dev/lib/core/chunk_string.hpp index 77e6864..7e5360c 100644 --- a/dev/lib/core/chunk_string.hpp +++ b/dev/lib/core/chunk_string.hpp @@ -46,6 +46,19 @@ namespace ocl basic_chunk_string(const basic_chunk_string&) = delete; public: + /// @brief Append a std::basic_string to the chunk string. + basic_chunk_string& operator+=(const char_type* in) + { + if (in == nullptr || bad_) + return *this; + + const auto& sz = std::strlen(in); + + this->operator+=(std::basic_string<char_type>(in, sz)); + + return *this; + } + basic_chunk_string& operator+=(const std::basic_string<char_type>& in) { if (in.empty() || bad_) @@ -76,6 +89,7 @@ namespace ocl return *this; } + /// @brief Convert to basic_string or return from cache. std::basic_string<char_type> str() const noexcept { static std::basic_string<char_type> ret; |
