diff options
author | prout <prout@yandex-team.com> | 2023-11-02 01:48:59 +0300 |
---|---|---|
committer | prout <prout@yandex-team.com> | 2023-11-02 02:10:31 +0300 |
commit | 87390bcd87e4553e147d5fb0f7aaa420aebb1966 (patch) | |
tree | 4273e04761695c660652ec589617d084a6e467b2 | |
parent | d287cc8c5d6dbf979dace3840f4b92bb667b361d (diff) | |
download | ydb-87390bcd87e4553e147d5fb0f7aaa420aebb1966.tar.gz |
TSplitRange::Count fix
-rw-r--r-- | util/string/split.h | 2 | ||||
-rw-r--r-- | util/string/split_ut.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/util/string/split.h b/util/string/split.h index bc46d9e64c..e351ecbebd 100644 --- a/util/string/split.h +++ b/util/string/split.h @@ -814,7 +814,7 @@ namespace NStringSplitPrivate { Y_ENSURE(TryCollectInto<Args...>(args...)); } - inline size_t Count() const { + inline size_t Count() { size_t cnt = 0; for (auto&& it : *this) { Y_UNUSED(it); diff --git a/util/string/split_ut.cpp b/util/string/split_ut.cpp index 43e59f2d75..ce3054bce1 100644 --- a/util/string/split_ut.cpp +++ b/util/string/split_ut.cpp @@ -305,8 +305,11 @@ Y_UNIT_TEST_SUITE(SplitStringTest) { template <typename I, typename C> void TestStringSplitterCount(I* str, C delim, size_t good) { - size_t res = StringSplitter(str).Split(delim).Count(); + auto split = StringSplitter(str).Split(delim); + size_t res = split.Count(); UNIT_ASSERT_VALUES_EQUAL(res, good); + res = split.Count(); + UNIT_ASSERT_VALUES_EQUAL(res, 0); } Y_UNIT_TEST_SUITE(StringSplitter) { |