From 721190afffc0f8c7497674d0d6f275b3bda0f79b Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Fri, 3 Apr 2020 22:25:21 +1100 Subject: [PATCH] Have example C++ program check for -std=c++11 --- example/crc32/crc32.cc | 4 ++++ example/jsonfindptrs/jsonfindptrs.cc | 4 ++++ example/jsonptr/jsonptr.cc | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/example/crc32/crc32.cc b/example/crc32/crc32.cc index 49f4a096..e0e3261d 100644 --- a/example/crc32/crc32.cc +++ b/example/crc32/crc32.cc @@ -27,6 +27,10 @@ $CXX crc32.cc && ./a.out < ../../README.md; rm -f a.out for a C++ compiler $CXX, such as clang++ or g++. */ +#if defined(__cplusplus) && (__cplusplus < 201103L) +#error "This C++ program requires -std=c++11 or later" +#endif + #include #include #include diff --git a/example/jsonfindptrs/jsonfindptrs.cc b/example/jsonfindptrs/jsonfindptrs.cc index ad5cf8df..c6e506dc 100644 --- a/example/jsonfindptrs/jsonfindptrs.cc +++ b/example/jsonfindptrs/jsonfindptrs.cc @@ -57,6 +57,10 @@ $CXX jsonfindptrs.cc && ./a.out < ../../test/data/github-tags.json; rm -f a.out for a C++ compiler $CXX, such as clang++ or g++. */ +#if defined(__cplusplus) && (__cplusplus < 201103L) +#error "This C++ program requires -std=c++11 or later" +#endif + #include #include #include diff --git a/example/jsonptr/jsonptr.cc b/example/jsonptr/jsonptr.cc index 58d21566..f5d72aba 100644 --- a/example/jsonptr/jsonptr.cc +++ b/example/jsonptr/jsonptr.cc @@ -94,6 +94,10 @@ $CXX jsonptr.cc && ./a.out < ../../test/data/github-tags.json; rm -f a.out for a C++ compiler $CXX, such as clang++ or g++. */ +#if defined(__cplusplus) && (__cplusplus < 201103L) +#error "This C++ program requires -std=c++11 or later" +#endif + #include #include #include