Browse Source

cmAlgorithms: add utility functions to get signed size of containers

Bruno Manganelli 6 years ago
parent
commit
70e245f19e
1 changed files with 6 additions and 0 deletions
  1. 6 0
      Source/cmAlgorithms.h

+ 6 - 0
Source/cmAlgorithms.h

@@ -396,6 +396,12 @@ constexpr
 
 #endif
 
+template <typename T>
+int isize(const T& t)
+{
+  return static_cast<int>(cm::size(t));
+}
+
 #if __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L
 
 using std::cbegin;