summaryrefslogtreecommitdiff
path: root/test/string/suffixArray.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 21:17:29 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 21:17:29 +0100
commit1880ccb6d85c6eb79e724593457877bab431951c (patch)
tree23eddd5bd0b29b3024e170a5ef9023eda9226ab5 /test/string/suffixArray.cpp
parente95f59debd69ee7d45d5c966ce466d23264e1c3c (diff)
get rid of all() and sz()
Diffstat (limited to 'test/string/suffixArray.cpp')
-rw-r--r--test/string/suffixArray.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/string/suffixArray.cpp b/test/string/suffixArray.cpp
index 4945d8e..a1db190 100644
--- a/test/string/suffixArray.cpp
+++ b/test/string/suffixArray.cpp
@@ -2,9 +2,9 @@
#include <string/suffixArray.cpp>
vector<int> naive(string_view s) {
- vector<int> SA(sz(s));
- iota(all(SA), 0);
- sort(all(SA), [s](int a, int b){
+ vector<int> SA(ssize(s));
+ iota(begin(SA), end(SA), 0);
+ ranges::sort(SA, [s](int a, int b){
return s.substr(a) < s.substr(b);
});
return SA;
@@ -12,7 +12,7 @@ vector<int> naive(string_view s) {
int lcp(string_view s, int x, int y) {
int res = 0;
- while (x + res < sz(s) && y + res < sz(s) && s[x + res] == s[y + res]) res++;
+ while (x + res < ssize(s) && y + res < ssize(s) && s[x + res] == s[y + res]) res++;
return res;
}
@@ -50,7 +50,7 @@ void performance_test() {
SuffixArray sa(s);
t.stop();
hash_t hash = 0;
- for (int i = 0; i < sz(sa.SA); i++) hash += i*sa.SA[i];
+ for (int i = 0; i < ssize(sa.SA); i++) hash += i*sa.SA[i];
if (t.time > 500) cerr << "too slow: " << t.time << FAIL;
cerr << "tested performance: " << t.time << "ms (hash: " << hash << ")" << endl;
}