diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2021-04-30 13:24:19 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2021-06-11 23:30:08 +0200 |
commit | b24e689cb561d81745ff47a5ce4595b809923914 (patch) | |
tree | cd1880b963222bffd350204ec62bee5bd39da511 /src/corelib/configure.cmake | |
parent | de2c3ccd49cb89e0c6912da3b03705a36ef03946 (diff) |
QLatin1String: optimize indexOf
Some time ago I wanted to use QStringTokenizer with a QL1S haystack and
needle to optimize a particular bottleneck. Only to realize the new
bottleneck was more expensive (continuously converting both the strings
to QString).
Change-Id: Ica86db0043c839c2336a3c3886ffbe3875659b5b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/configure.cmake')
-rw-r--r-- | src/corelib/configure.cmake | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/corelib/configure.cmake b/src/corelib/configure.cmake index e82ac8bf93..e363c44b58 100644 --- a/src/corelib/configure.cmake +++ b/src/corelib/configure.cmake @@ -156,6 +156,28 @@ std::mt19937 mt(0); } ") +# cxx17_bm_searcher +qt_config_compile_test(cxx17_bm_searcher + LABEL "C++17 boyer_moore_searcher" + CODE +"#include <algorithm> +#include <functional> + +int main(void) +{ + /* BEGIN TEST: */ +const char haystack[] = \"hello\"; +const char needle[] = \"e\"; +const auto it = +std::search(haystack + 0, haystack + std::size(haystack), +std::boyer_moore_searcher(needle + 0, needle + std::size(needle))); +(void)it; + /* END TEST: */ + return 0; +} +"# FIXME: qmake: CONFIG += c++17 +) + # cxx17_filesystem qt_config_compile_test(cxx17_filesystem LABEL "C++17 <filesystem>" @@ -519,6 +541,10 @@ qt_feature("cxx11_future" PUBLIC LABEL "C++11 <future>" CONDITION TEST_cxx11_future ) +qt_feature("cxx17_bm_searcher" PRIVATE + LABEL "C++17 boyer_moore_searcher" + CONDITION TEST_cxx17_bm_searcher +) qt_feature("cxx17_filesystem" PUBLIC LABEL "C++17 <filesystem>" CONDITION TEST_cxx17_filesystem |