From 5eec9085f8c1cebdf77799ab81a4b3d743519ad8 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 9 Apr 2024 22:40:37 -0500 Subject: [PATCH] [ox/std] Add nodiscard to some string functions --- deps/ox/src/ox/std/strops.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deps/ox/src/ox/std/strops.hpp b/deps/ox/src/ox/std/strops.hpp index d3236d87..e3c943e9 100644 --- a/deps/ox/src/ox/std/strops.hpp +++ b/deps/ox/src/ox/std/strops.hpp @@ -80,6 +80,7 @@ constexpr bool endsWith(CRStringView base, CRStringView ending) noexcept { return base.len() >= endingLen && ox_strcmp(base.data() + (base.len() - endingLen), ending) == 0; } +[[nodiscard]] constexpr std::size_t find(CRStringView str, char search) noexcept { std::size_t i = 0; for (; i < str.len(); ++i) { @@ -90,6 +91,7 @@ constexpr std::size_t find(CRStringView str, char search) noexcept { return i; } +[[nodiscard]] constexpr std::size_t find(CRStringView str, CRStringView search) noexcept { std::size_t i = 0; for (; i < str.len(); ++i) { @@ -101,6 +103,7 @@ constexpr std::size_t find(CRStringView str, CRStringView search) noexcept { } template +[[nodiscard]] constexpr ox::Vector split(CRStringView str, char del) noexcept { ox::Vector out; constexpr auto nextSeg = [](CRStringView current, char del) { @@ -117,6 +120,7 @@ constexpr ox::Vector split(CRStringView str, char del) } template +[[nodiscard]] constexpr ox::Vector split(CRStringView str, CRStringView del) noexcept { ox::Vector out; constexpr auto nextSeg = [](CRStringView current, CRStringView del) {