diff options
author | Brad King <brad.king@kitware.com> | 2019-02-27 16:32:31 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-27 16:32:31 (GMT) |
commit | 18731d60ac4f14c080ef593c1b1f0a5beb330b02 (patch) | |
tree | c362423252f1315568fa26c8c1e9d2a9347e1f18 /Source | |
parent | e0d7078f6fe49d28b6c511b8e95d3765637189b5 (diff) | |
parent | e17deb7ad4ac83207c9e34d397f3ee054b3d09dd (diff) | |
download | CMake-18731d60ac4f14c080ef593c1b1f0a5beb330b02.zip CMake-18731d60ac4f14c080ef593c1b1f0a5beb330b02.tar.gz CMake-18731d60ac4f14c080ef593c1b1f0a5beb330b02.tar.bz2 |
Merge branch 'backport-check-std-size-cbegin-cend' into release-3.14
Merge-request: !3030
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Checks/cm_cxx14_check.cpp | 9 | ||||
-rw-r--r-- | Source/Checks/cm_cxx17_check.cpp | 11 |
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 4e89184..9ea52c4 100644 --- a/Source/Checks/cm_cxx17_check.cpp +++ b/Source/Checks/cm_cxx17_check.cpp @@ -1,9 +1,18 @@ #include <cstdio> +#include <iterator> #include <memory> #include <unordered_map> 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)); - return *u; + return *u + *ai + *(bi - 1) + (3 - static_cast<int>(ci)); } |