diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/string/strspn.h | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/string/strspn.h')
-rw-r--r-- | util/string/strspn.h | 112 |
1 files changed, 56 insertions, 56 deletions
diff --git a/util/string/strspn.h b/util/string/strspn.h index 8229e74a9c..a6e4ff0fd6 100644 --- a/util/string/strspn.h +++ b/util/string/strspn.h @@ -1,65 +1,65 @@ -#pragma once - -#include "cstriter.h" - -#include <util/generic/bitmap.h> - +#pragma once + +#include "cstriter.h" + +#include <util/generic/bitmap.h> + template <class TSetType> -class TStrSpnImpl { -public: - inline TStrSpnImpl(const char* b, const char* e) { - Init(b, e); - } - - inline TStrSpnImpl(const char* s) { - Init(s, TCStringEndIterator()); - } - - //FirstOf - template <class It> +class TStrSpnImpl { +public: + inline TStrSpnImpl(const char* b, const char* e) { + Init(b, e); + } + + inline TStrSpnImpl(const char* s) { + Init(s, TCStringEndIterator()); + } + + //FirstOf + template <class It> inline It FindFirstOf(It b, const char* e) const noexcept { - return FindFirst<false>(b, e); - } - - template <class It> + return FindFirst<false>(b, e); + } + + template <class It> inline It FindFirstOf(It s) const noexcept { - return FindFirst<false>(s, TCStringEndIterator()); - } - - //FirstNotOf - template <class It> + return FindFirst<false>(s, TCStringEndIterator()); + } + + //FirstNotOf + template <class It> inline It FindFirstNotOf(It b, const char* e) const noexcept { - return FindFirst<true>(b, e); - } - - template <class It> + return FindFirst<true>(b, e); + } + + template <class It> inline It FindFirstNotOf(It s) const noexcept { - return FindFirst<true>(s, TCStringEndIterator()); - } - + return FindFirst<true>(s, TCStringEndIterator()); + } + inline void Set(ui8 b) noexcept { - S_.Set(b); - } - -private: - template <bool Result, class It1, class It2> + S_.Set(b); + } + +private: + template <bool Result, class It1, class It2> inline It1 FindFirst(It1 b, It2 e) const noexcept { - while (b != e && (S_.Get((ui8)*b) == Result)) { - ++b; - } - - return b; - } - - template <class It1, class It2> - inline void Init(It1 b, It2 e) { - while (b != e) { - this->Set((ui8)*b++); - } - } - -private: + while (b != e && (S_.Get((ui8)*b) == Result)) { + ++b; + } + + return b; + } + + template <class It1, class It2> + inline void Init(It1 b, It2 e) { + while (b != e) { + this->Set((ui8)*b++); + } + } + +private: TSetType S_; -}; - +}; + using TCompactStrSpn = TStrSpnImpl<TBitMap<256>>; |