mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-11-27 06:30:28 +08:00
Fixed two bad errors on std::vector.
First, MSVC 2010 does not ship a 'fixed'/'adapted' STL. Second, only under very rare cases we do not even need the aligned_allocator.
This commit is contained in:
parent
028bb7ea48
commit
2db5387488
@ -28,9 +28,7 @@
|
||||
#include "Core"
|
||||
#include <list>
|
||||
|
||||
#if (defined(_MSC_VER) && defined(_WIN64)) || /* MSVC auto aligns in 64 bit builds */ \
|
||||
(defined(_MSC_VER) && _MSC_VER >= 1600) || /* MSVC 2010 ships alignment compatible STL libs */ \
|
||||
(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&). */
|
||||
#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */
|
||||
|
||||
#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...)
|
||||
|
||||
|
@ -29,9 +29,7 @@
|
||||
#include "Core"
|
||||
#include <vector>
|
||||
|
||||
#if (defined(_MSC_VER) && defined(_WIN64)) || /* MSVC auto aligns in 64 bit builds */ \
|
||||
(defined(_MSC_VER) && _MSC_VER >= 1600) || /* MSVC 2010 ships alignment compatible STL libs */ \
|
||||
(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&). */
|
||||
#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */
|
||||
|
||||
#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...)
|
||||
|
||||
|
@ -66,6 +66,9 @@ 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&). */
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
@ -91,7 +94,7 @@ namespace std
|
||||
template<typename T>
|
||||
class list<T,Eigen::aligned_allocator<T> >
|
||||
: public list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
|
||||
{
|
||||
typedef list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > list_base;
|
||||
@ -121,4 +124,6 @@ namespace std
|
||||
};
|
||||
}
|
||||
|
||||
#endif // check whether specialization is actually required
|
||||
|
||||
#endif // EIGEN_STDLIST_H
|
||||
|
@ -67,6 +67,9 @@ 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::vector::resize(size_type,const T&). */
|
||||
|
||||
namespace std {
|
||||
|
||||
#define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \
|
||||
@ -88,10 +91,10 @@ namespace std {
|
||||
return *this; \
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class vector<T,Eigen::aligned_allocator<T> >
|
||||
: public vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
|
||||
template<typename T>
|
||||
class vector<T,Eigen::aligned_allocator<T> >
|
||||
: public vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
|
||||
{
|
||||
typedef vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
|
||||
Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > vector_base;
|
||||
@ -101,6 +104,7 @@ class vector<T,Eigen::aligned_allocator<T> >
|
||||
{ resize(new_size, T()); }
|
||||
|
||||
#if defined(_VECTOR_)
|
||||
#pragma message("old method")
|
||||
// workaround MSVC std::vector implementation
|
||||
void resize(size_type new_size, const value_type& x)
|
||||
{
|
||||
@ -136,9 +140,9 @@ class vector<T,Eigen::aligned_allocator<T> >
|
||||
vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif // check whether specialization is actually required
|
||||
|
||||
#endif // EIGEN_STDVECTOR_H
|
||||
|
Loading…
Reference in New Issue
Block a user