Browse Source

Officially require C++11.

As it turns out, support for building with a c++98
compiler was broken several months (years?) ago, but nobody
noticed so far.

This commit updates the README and header file to
officially document that situation.
Benno Evers 6 years ago
parent
commit
65933e3d40
2 changed files with 14 additions and 10 deletions
  1. 11 1
      README.md
  2. 3 9
      matplotlibcpp.h

+ 11 - 1
README.md

@@ -65,7 +65,7 @@ int main()
 
 
 ![Basic example](./examples/basic.png)
 ![Basic example](./examples/basic.png)
 
 
-matplotlib-cpp doesn't require C++11, but will enable some additional syntactic sugar when available:
+Alternatively, matplotlib-cpp also supports some C++11-powered syntactic sugar:
 ```cpp
 ```cpp
 #include <cmath>
 #include <cmath>
 #include "matplotlibcpp.h"
 #include "matplotlibcpp.h"
@@ -186,6 +186,16 @@ find_package(PythonLibs 2.7)
 target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS})
 target_include_directories(myproject PRIVATE ${PYTHON_INCLUDE_DIRS})
 target_link_libraries(myproject ${PYTHON_LIBRARIES})
 target_link_libraries(myproject ${PYTHON_LIBRARIES})
 ```
 ```
+
+# C++11
+
+Currently, c++11 is required to build matplotlib-cpp. The last working commit that did
+not have this requirement was `717e98e752260245407c5329846f5d62605eff08`.
+
+Note that support for c++98 was dropped more or less accidentally, so if you have to work
+with an ancient compiler and still want to enjoy the latest additional features, I'd
+probably merge a PR that restores support.
+
 # Python 3
 # Python 3
 
 
 This library supports both python2 and python3 (although the python3 support is probably far less tested,
 This library supports both python2 and python3 (although the python3 support is probably far less tested,

+ 3 - 9
matplotlibcpp.h

@@ -6,11 +6,8 @@
 #include <algorithm>
 #include <algorithm>
 #include <stdexcept>
 #include <stdexcept>
 #include <iostream>
 #include <iostream>
-#include <stdint.h> // <cstdint> requires c++11 support
-
-#if __cplusplus > 199711L || _MSC_VER > 1800
-#  include <functional>
-#endif
+#include <cstdint> // <cstdint> requires c++11 support
+#include <functional>
 
 
 #include <Python.h>
 #include <Python.h>
 
 
@@ -1394,8 +1391,7 @@ inline void tight_layout() {
     Py_DECREF(res);
     Py_DECREF(res);
 }
 }
 
 
-#if __cplusplus > 199711L || _MSC_VER > 1800
-// C++11-exclusive content starts here (variadic plot() and initializer list support)
+// Support for variadic plot() and initializer lists:
 
 
 namespace detail {
 namespace detail {
 
 
@@ -1524,6 +1520,4 @@ inline bool plot(const std::vector<double>& x, const std::vector<double>& y, con
     return plot<double>(x,y,keywords);
     return plot<double>(x,y,keywords);
 }
 }
 
 
-#endif
-
 } // end namespace matplotlibcpp
 } // end namespace matplotlibcpp