summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-28 16:00:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-02-28 16:00:13 (GMT)
commita4f2dd9577d23e77ad4daeea0e32bd8283204bdb (patch)
treec858ce900a8d30a79a20c73cb1b59a93e03ecf9c /Source
parent93091cabace0b690fb1d977a6df219a42751bb12 (diff)
parente6195989c7124904b6263a64e0b16938987cdfcd (diff)
downloadCMake-a4f2dd9577d23e77ad4daeea0e32bd8283204bdb.zip
CMake-a4f2dd9577d23e77ad4daeea0e32bd8283204bdb.tar.gz
CMake-a4f2dd9577d23e77ad4daeea0e32bd8283204bdb.tar.bz2
Merge topic 'check-std-size-cbegin-cend'
e6195989c7 Merge branch 'backport-check-std-size-cbegin-cend' a605bf438e Extend C++17/C++14 feature checks to cover more standard library APIs e17deb7ad4 Extend C++17/C++14 feature checks to cover more standard library APIs Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3030
Diffstat (limited to 'Source')
-rw-r--r--Source/Checks/cm_cxx14_check.cpp9
-rw-r--r--Source/Checks/cm_cxx17_check.cpp11
2 files changed, 18 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx14_check.cpp b/Source/Checks/cm_cxx14_check.cpp
index 9369ba2..fff36c9 100644
--- a/Source/Checks/cm_cxx14_check.cpp
+++ b/Source/Checks/cm_cxx14_check.cpp
@@ -1,8 +1,15 @@
#include <cstdio>
+#include <iterator>
#include <memory>
int main()
{
+ int a[] = { 0, 1, 2 };
+ auto ai = std::cbegin(a);
+
+ int b[] = { 2, 1, 0 };
+ auto bi = std::cend(b);
+
std::unique_ptr<int> u(new int(0));
- return *u;
+ return *u + *ai + *(bi - 1);
}
diff --git a/Source/Checks/cm_cxx17_check.cpp b/Source/Checks/cm_cxx17_check.cpp
index 2de10d6..593d9b2 100644
--- a/Source/Checks/cm_cxx17_check.cpp
+++ b/Source/Checks/cm_cxx17_check.cpp
@@ -1,4 +1,5 @@
#include <cstdio>
+#include <iterator>
#include <memory>
#include <unordered_map>
@@ -8,6 +9,14 @@
int main()
{
+ int a[] = { 0, 1, 2 };
+ auto ai = std::cbegin(a);
+
+ int b[] = { 2, 1, 0 };
+ auto bi = std::cend(b);
+
+ auto ci = std::size(a);
+
std::unique_ptr<int> u(new int(0));
#ifdef _MSC_VER
@@ -18,5 +27,5 @@ int main()
IDispatchPtr disp(ptr);
#endif
- return *u;
+ return *u + *ai + *(bi - 1) + (3 - static_cast<int>(ci));
}