mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
Added a resize method to MaxSizeVector
This commit is contained in:
parent
87a8a1975e
commit
a618094b62
@ -55,6 +55,17 @@ class MaxSizeVector {
|
|||||||
internal::aligned_free(data_);
|
internal::aligned_free(data_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void resize(size_t n) {
|
||||||
|
eigen_assert(n <= reserve_);
|
||||||
|
for (size_t i = size_; i < n; ++i) {
|
||||||
|
new (&data_[i]) T;
|
||||||
|
}
|
||||||
|
for (size_t i = n; i < size_; ++i) {
|
||||||
|
data_[i].~T();
|
||||||
|
}
|
||||||
|
size_ = n;
|
||||||
|
}
|
||||||
|
|
||||||
// Append new elements (up to reserved size).
|
// Append new elements (up to reserved size).
|
||||||
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
|
||||||
void push_back(const T& t) {
|
void push_back(const T& t) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user