aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/StdVector
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-02-07 12:46:04 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-02-07 12:46:04 +0000
commit365ec0744ca24afdceb9a2bd706a7226af379e06 (patch)
tree0777bd05a60f3b0f2af286aaeacb4785c690243b /Eigen/StdVector
parent671398372b1060e02bc113860f2e05cb498a18f4 (diff)
disable vector::resize() workaround for gcc < 4.1 (they already use a const
reference)
Diffstat (limited to 'Eigen/StdVector')
-rw-r--r--Eigen/StdVector23
1 files changed, 14 insertions, 9 deletions
diff --git a/Eigen/StdVector b/Eigen/StdVector
index 8fb35a5e5..0298b9e3a 100644
--- a/Eigen/StdVector
+++ b/Eigen/StdVector
@@ -95,15 +95,8 @@ class vector<T,DummyAlloc,true>
void resize(size_type __new_size)
{ resize(__new_size, T()); }
- #if defined(_GLIBCXX_VECTOR)
- void resize(size_type __new_size, const value_type& __x)
- {
- if (__new_size < vector_base::size())
- vector_base::_M_erase_at_end(this->_M_impl._M_start + __new_size);
- else
- vector_base::insert(vector_base::end(), __new_size - vector_base::size(), __x);
- }
- #elif defined(_VECTOR_)
+ #if defined(_VECTOR_)
+ // workaround MSVC std::vector implementation
void resize(size_type __new_size, const value_type& __x)
{
if (vector_base::size() < __new_size)
@@ -111,6 +104,18 @@ class vector<T,DummyAlloc,true>
else if (__new_size < vector_base::size())
vector_base::erase(vector_base::begin() + __new_size, vector_base::end());
}
+ #elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,1)
+ // workaround GCC std::vector implementation
+ // Note that before gcc-4.1 we already have: std::vector::resize(size_type,const T&),
+ // no no need to workaround !
+ void resize(size_type __new_size, const value_type& __x)
+ {
+ if (__new_size < vector_base::size())
+ vector_base::_M_erase_at_end(this->_M_impl._M_start + __new_size);
+ else
+ vector_base::insert(vector_base::end(), __new_size - vector_base::size(), __x);
+ }
+
#endif
};