1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-17 07:11:52 +08:00

cmNonempty: Convenience inlines to check for non-empty string

This commit is contained in:
Vitaly Stakhovsky
2020-07-14 15:00:00 -04:00
parent 2da778664d
commit eaad8072ee
19 changed files with 69 additions and 58 deletions

View File

@@ -20,6 +20,20 @@
/** String range type. */
using cmStringRange = cmRange<std::vector<std::string>::const_iterator>;
/** Check for non-empty string. */
inline bool cmNonempty(const char* str)
{
return str && *str;
}
inline bool cmNonempty(cm::string_view str)
{
return !str.empty();
}
inline bool cmNonempty(std::string const* str)
{
return str && !str->empty();
}
/** Callable string comparison struct. */
struct cmStrCmp
{