summaryrefslogtreecommitdiffstats
path: root/Source/cmStringAlgorithms.h
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-09-09 12:21:20 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-09-09 12:21:26 (GMT)
commite366977e62edc366e5b7ac38ed6c1c5cf729b428 (patch)
tree6323e24d8740467eec569ea72cf3aa419137c44e /Source/cmStringAlgorithms.h
parent9a0a5f84208f652d3ce84e141adf7e9b304574cb (diff)
parent0c9cdf30ed91fb4705efed578f90af3226d8fe9f (diff)
downloadCMake-e366977e62edc366e5b7ac38ed6c1c5cf729b428.zip
CMake-e366977e62edc366e5b7ac38ed6c1c5cf729b428.tar.gz
CMake-e366977e62edc366e5b7ac38ed6c1c5cf729b428.tar.bz2
Merge topic 'cmstrlen'
0c9cdf30ed cmStringAlgorithms: Add cmStrLen() Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5201
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 f3c262b..01e3d94 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
{