diff options
author | Brad King <brad.king@kitware.com> | 2020-09-08 15:17:22 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-09-08 15:17:29 (GMT) |
commit | 0bd964096859944ae28506fc8c0789df252865a6 (patch) | |
tree | 4bbab3b3ec07c4a659bf8c300c06602a57c8ff5b /Source/cmStringAlgorithms.h | |
parent | 679b5512bdf8640012d216d67b7c670298d48599 (diff) | |
parent | 38928ee3ee40179ec4ad295c72cf5aaa213f617e (diff) | |
download | CMake-0bd964096859944ae28506fc8c0789df252865a6.zip CMake-0bd964096859944ae28506fc8c0789df252865a6.tar.gz CMake-0bd964096859944ae28506fc8c0789df252865a6.tar.bz2 |
Merge topic 'optimize-cmJoin'
38928ee3ee cmStringAlgorithms: Add faster cmJoin overloads for strings
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5185
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r-- | Source/cmStringAlgorithms.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h index 6508069..f3c262b 100644 --- a/Source/cmStringAlgorithms.h +++ b/Source/cmStringAlgorithms.h @@ -80,6 +80,17 @@ std::string cmJoin(Range const& rng, cm::string_view separator) return os.str(); } +/** + * Faster overloads for std::string ranges. + * If @a initial is provided, it prepends the resulted string without + * @a separator between them. + */ +std::string cmJoin(std::vector<std::string> const& rng, + cm::string_view separator, cm::string_view initial = {}); + +std::string cmJoin(cmStringRange const& rng, cm::string_view separator, + cm::string_view initial = {}); + /** Extract tokens that are separated by any of the characters in @a sep. */ std::vector<std::string> cmTokenize(cm::string_view str, cm::string_view sep); |