From f9913fa28a27f23fde2d4956c62cbb2fb2bc2ee8 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Thu, 21 Nov 2013 22:16:57 +0100 Subject: Boost/C++11 shared pointers. --- .../CheckCXX11Features/cxx11-test-regex.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp (limited to 'cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp') diff --git a/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp b/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp new file mode 100644 index 00000000..2fe01c4f --- /dev/null +++ b/cmake/cmake-cxx11/Modules/CheckCXX11Features/cxx11-test-regex.cpp @@ -0,0 +1,26 @@ +#include +#include + +int parse_line(std::string const& line) +{ + std::string tmp; + if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+//(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+//(-)?(\\d)+"), std::string("V")); + } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); + } else if(std::regex_search(line, std::regex("(\\s)+(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+(\\s)+"))) { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+/(-)?(\\d)+/(-)?(\\d)+"), std::string("V")); + } else { + tmp = std::regex_replace(line, std::regex("(-)?(\\d)+"), std::string("V")); + } + return static_cast(std::count(tmp.begin(), tmp.end(), 'V')); +} + +int main() +{ + bool test = (parse_line("f 7/7/7 -3/3/-3 2/-2/2") == 3) && + (parse_line("f 7//7 3//-3 -2//2") == 3) && + (parse_line("f 7/7 3/-3 -2/2") == 3) && + (parse_line("f 7 3 -2") == 3); + return test ? 0 : 1; +} -- cgit v1.2.3