fix missing string def

v1
Brett 2024-09-16 16:48:05 -04:00
parent e3c925ed11
commit 5375231ce5
2 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake)
set(BLT_VERSION 0.20.5)
set(BLT_VERSION 0.20.6)
set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT)

View File

@ -91,7 +91,16 @@ namespace blt::string
#endif
}
BLT_CPP20_CONSTEXPR bool ends_with(std::string_view string, std::string_view search);
inline BLT_CPP20_CONSTEXPR bool ends_with(std::string_view string, std::string_view search)
{
#ifdef BLT_USE_CPP20
return string.ends_with(search);
#else
if (string.empty())
return false;
return string.substr(string.size() - search.size()) == search;
#endif
}
static inline BLT_CPP20_CONSTEXPR bool ends_with(std::string_view string, char search)
{