-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Description
I needed to build docopt using GCC 4.8, because this is default compiler in CentOS 7.
GCC 4.8 C++11 support is good, but all the <regex> functionalities are missing. So I created a fallback to Boost.Regex when building with GCC 4.8, and used C++11 regex in all other cases.
I used the following diff:
diff --git a/docopt.cpp b/docopt.cpp
index 2fd5f42..ce983c5 100644
--- a/docopt.cpp
+++ b/docopt.cpp
@@ -17,9 +17,24 @@
#include <unordered_map>
#include <map>
#include <string>
-#include <regex>
#include <iostream>
#include <cassert>
#include <cstddef>
+#ifdef DOCOPT_USES_BOOST_REGEX
+#include <boost/regex.hpp>
+namespace std {
+ using boost::regex;
+ using boost::sregex_iterator;
+ using boost::smatch;
+ using boost::regex_search;
+ namespace regex_constants {
+ using boost::regex_constants::match_not_null;
+ }
+}
+#else
+#include <regex>
+#endifIf you want to include this in docopt, I can do a PR.
Metadata
Metadata
Assignees
Labels
No labels