Merge topic 'cmnonempty'

eaad8072ee cmNonempty: Convenience inlines to check for non-empty string

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5017
This commit is contained in:
Kyle Edwards
2020-07-15 14:53:35 +00:00
committed by Kitware Robot
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
{