From c940a9dbbd1d110632fae546d14db3d175c98fa2 Mon Sep 17 00:00:00 2001 From: SnapperTT <4939563+SnapperTT@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:36:51 +0700 Subject: [PATCH 1/3] Update main.cpp --- example/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/example/main.cpp b/example/main.cpp index ba068a0..19807a1 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -1,6 +1,7 @@ #include #include #include +#inlcude int main() { @@ -97,4 +98,4 @@ int main() /* swap */ l.swap(k); // l is "xyz" and k is "34" swap(l, k); // l is "34" and k is "xyz" -} \ No newline at end of file +} From 3ee567484432abb07c958d4a14dd058c3db8714e Mon Sep 17 00:00:00 2001 From: SnapperTT <4939563+SnapperTT@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:49:41 +0700 Subject: [PATCH 2/3] Update main.cpp --- example/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/main.cpp b/example/main.cpp index 19807a1..62c941f 100644 --- a/example/main.cpp +++ b/example/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#inlcude +#include int main() { From 1d7ceb0da78090b5c2ff8bbafd1dcb61854cfd53 Mon Sep 17 00:00:00 2001 From: SnapperTT <4939563+SnapperTT@users.noreply.github.com> Date: Wed, 6 Sep 2023 22:09:49 +0700 Subject: [PATCH 3/3] Implemented custom size type --- include/FastString.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/FastString.h b/include/FastString.h index 6ae7c39..2812904 100644 --- a/include/FastString.h +++ b/include/FastString.h @@ -4,12 +4,16 @@ #include #include #include +#include namespace fss { - template > + template > class basic_str { + + static_assert(SizeType(-1) >= max_length); + public: constexpr basic_str() noexcept = default; @@ -124,7 +128,7 @@ namespace fss buffer_[active_length_] = '\0'; } - std::size_t active_length_{0}; + SizeType active_length_{0}; CharT buffer_[max_length + 1]{}; };