summaryrefslogtreecommitdiffstats
path: root/Source/cmStringAlgorithms.h
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-09-03 15:50:25 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-09-08 14:15:54 (GMT)
commit0c9cdf30ed91fb4705efed578f90af3226d8fe9f (patch)
tree48bed865afbe34bcd23374cb88e0c17c18a3c467 /Source/cmStringAlgorithms.h
parent412cc37d357fbbaf5b67e54585dbdd1fbc0a6ae2 (diff)
downloadCMake-0c9cdf30ed91fb4705efed578f90af3226d8fe9f.zip
CMake-0c9cdf30ed91fb4705efed578f90af3226d8fe9f.tar.gz
CMake-0c9cdf30ed91fb4705efed578f90af3226d8fe9f.tar.bz2
cmStringAlgorithms: Add cmStrLen()
Diffstat (limited to 'Source/cmStringAlgorithms.h')
-rw-r--r--Source/cmStringAlgorithms.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmStringAlgorithms.h b/Source/cmStringAlgorithms.h
index 6508069..81667db 100644
--- a/Source/cmStringAlgorithms.h
+++ b/Source/cmStringAlgorithms.h
@@ -33,6 +33,13 @@ inline bool cmNonempty(std::string const* str)
return str && !str->empty();
}
+/** Returns length of a literal string. */
+template <size_t N>
+constexpr size_t cmStrLen(const char (&/*str*/)[N])
+{
+ return N - 1;
+}
+
/** Callable string comparison struct. */
struct cmStrCmp
{