From 2e5d46c399fd26bc15be212914b72cd9a7b83f70 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 5 Jul 2022 14:34:29 +0200 Subject: [PATCH] util/StringSplit: add `constexpr` --- src/util/StringSplit.hxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/util/StringSplit.hxx b/src/util/StringSplit.hxx index 10eb86f9a..3a9c611d2 100644 --- a/src/util/StringSplit.hxx +++ b/src/util/StringSplit.hxx @@ -51,8 +51,7 @@ Partition(const std::basic_string_view haystack, } template -[[gnu::pure]] -std::pair, std::basic_string_view> +constexpr std::pair, std::basic_string_view> PartitionWithout(const std::basic_string_view haystack, const typename std::basic_string_view::size_type separator) noexcept { @@ -68,8 +67,7 @@ PartitionWithout(const std::basic_string_view haystack, * string and the second value is nullptr. */ template -[[gnu::pure]] -std::pair, std::basic_string_view> +constexpr std::pair, std::basic_string_view> Split(const std::basic_string_view haystack, const T ch) noexcept { const auto i = haystack.find(ch); @@ -85,8 +83,7 @@ Split(const std::basic_string_view haystack, const T ch) noexcept * value is the whole string and the second value is nullptr. */ template -[[gnu::pure]] -std::pair, std::basic_string_view> +constexpr std::pair, std::basic_string_view> SplitLast(const std::basic_string_view haystack, const T ch) noexcept { const auto i = haystack.rfind(ch);