From 28358cd20966b07f020db59507d64835b3d51df7 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 11 Feb 2023 13:25:19 -0800 Subject: [PATCH] template second parameter for startsWith Signed-off-by: Rosen Penev --- src/utils.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils.hpp b/src/utils.hpp index c385b07d..ffb0fffd 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -6,8 +6,13 @@ namespace Exiv2::Internal { -constexpr bool startsWith(std::string_view s, std::string_view start) { +template +constexpr bool startsWith(std::string_view s, T start) { +#ifdef __cpp_lib_starts_ends_with + return s.starts_with(start); +#else return s.find(start) == 0; +#endif } /// @brief Returns the uppercase version of \b str