From 6f6b5ad016da39207f88d6f255c7c5ca2787bcae Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 21 Apr 2009 21:40:33 +0000 Subject: [PATCH] add a generic version of std::vector::resize for other stl implementations --- Eigen/StdVector | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Eigen/StdVector b/Eigen/StdVector index 46f927ee4..6d629061f 100644 --- a/Eigen/StdVector +++ b/Eigen/StdVector @@ -120,8 +120,17 @@ class vector > else vector_base::insert(vector_base::end(), new_size - vector_base::size(), x); } -#else +#elif defined(_GLIBCXX_VECTOR) using vector_base::resize; +#else + // default implementation which should always work. + void resize(size_type new_size, const value_type& x) + { + if (new_size < vector_base::size()) + vector_base::erase(vector_base::begin() + new_size, vector_base::end()); + else if (new_size > vector_base::size()) + vector_base::insert(vector_base::end(), new_size - vector_base::size(), x); + } #endif };