diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2015-08-14 16:09:48 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2015-08-14 16:09:48 +0200 |
commit | 712e2fed1705746847d1cbdce01094eb42a45139 (patch) | |
tree | c127dd4f56c23afc091331c1adc82b748735e2ec | |
parent | a5d1bb2be8340e446d6f8ce24e0b1a8987e9be95 (diff) |
bug #829: Introduce macro EIGEN_HAS_CXX11_CONTAINERS and do not specialize std-containers if it is enabled.
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 9 | ||||
-rw-r--r-- | Eigen/src/StlSupport/StdDeque.h | 2 | ||||
-rw-r--r-- | Eigen/src/StlSupport/StdList.h | 4 | ||||
-rw-r--r-- | Eigen/src/StlSupport/StdVector.h | 5 |
4 files changed, 17 insertions, 3 deletions
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index e491d3389..b792f5ed4 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -370,6 +370,15 @@ #endif #endif +// Does the compiler support proper C++11 containers? +#ifndef EIGEN_HAS_CXX11_CONTAINERS + #if ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG)) || EIGEN_COMP_MSVC >= 1900 + #define EIGEN_HAS_CXX11_CONTAINERS 1 + #else + #define EIGEN_HAS_CXX11_CONTAINERS 0 + #endif +#endif + /** Allows to disable some optimizations which might affect the accuracy of the result. * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them. * They currently include: diff --git a/Eigen/src/StlSupport/StdDeque.h b/Eigen/src/StlSupport/StdDeque.h index 909600476..25930cb85 100644 --- a/Eigen/src/StlSupport/StdDeque.h +++ b/Eigen/src/StlSupport/StdDeque.h @@ -53,7 +53,7 @@ namespace std \ } // check whether we really need the std::deque specialization -#if !(defined(_GLIBCXX_DEQUE) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::deque::resize(size_type,const T&). */ +#if !EIGEN_HAS_CXX11_CONTAINERS && !(defined(_GLIBCXX_DEQUE) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::deque::resize(size_type,const T&). */ namespace std { diff --git a/Eigen/src/StlSupport/StdList.h b/Eigen/src/StlSupport/StdList.h index 265b46f8e..7412b50aa 100644 --- a/Eigen/src/StlSupport/StdList.h +++ b/Eigen/src/StlSupport/StdList.h @@ -51,8 +51,8 @@ namespace std \ }; \ } -// check whether we really need the std::vector specialization -#if !(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::list::resize(size_type,const T&). */ +// check whether we really need the std::list specialization +#if !EIGEN_HAS_CXX11_CONTAINERS && !(defined(_GLIBCXX_LIST) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::list::resize(size_type,const T&). */ namespace std { diff --git a/Eigen/src/StlSupport/StdVector.h b/Eigen/src/StlSupport/StdVector.h index 611664a2e..ec22821d2 100644 --- a/Eigen/src/StlSupport/StdVector.h +++ b/Eigen/src/StlSupport/StdVector.h @@ -44,6 +44,9 @@ namespace std \ }; \ } +// Don't specialize if containers are implemented according to C++11 +#if !EIGEN_HAS_CXX11_CONTAINERS + namespace std { #define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \ @@ -122,5 +125,7 @@ namespace std { #endif }; } +#endif // !EIGEN_HAS_CXX11_CONTAINERS + #endif // EIGEN_STDVECTOR_H |