11 #ifndef EIGEN_STDVECTOR_H 12 #define EIGEN_STDVECTOR_H 21 #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \ 25 class vector<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ 26 : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ 28 typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \ 30 typedef __VA_ARGS__ value_type; \ 31 typedef vector_base::allocator_type allocator_type; \ 32 typedef vector_base::size_type size_type; \ 33 typedef vector_base::iterator iterator; \ 34 explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ 35 template<typename InputIterator> \ 36 vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : vector_base(first, last, a) {} \ 37 vector(const vector& c) : vector_base(c) {} \ 38 explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ 39 vector(iterator start, iterator end) : vector_base(start, end) {} \ 40 vector& operator=(const vector& x) { \ 41 vector_base::operator=(x); \ 48 #if !EIGEN_HAS_CXX11_CONTAINERS 52 #define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \ 54 typedef T value_type; \ 55 typedef typename vector_base::allocator_type allocator_type; \ 56 typedef typename vector_base::size_type size_type; \ 57 typedef typename vector_base::iterator iterator; \ 58 typedef typename vector_base::const_iterator const_iterator; \ 59 explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ 60 template<typename InputIterator> \ 61 vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ 62 : vector_base(first, last, a) {} \ 63 vector(const vector& c) : vector_base(c) {} \ 64 explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ 65 vector(iterator start, iterator end) : vector_base(start, end) {} \ 66 vector& operator=(const vector& x) { \ 67 vector_base::operator=(x); \ 73 :
public vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
74 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
81 { resize(new_size, T()); }
85 void resize(size_type new_size,
const value_type& x)
90 vector_base::erase(vector_base::begin() + new_size, vector_base::end());
92 void push_back(
const value_type& x)
93 { vector_base::push_back(x); }
94 using vector_base::insert;
95 iterator insert(const_iterator position,
const value_type& x)
96 {
return vector_base::insert(position,x); }
97 void insert(const_iterator position, size_type new_size,
const value_type& x)
98 { vector_base::insert(position, new_size, x); }
99 #elif defined(_GLIBCXX_VECTOR) && (!(EIGEN_GNUC_AT_LEAST(4,1))) 102 void resize(size_type new_size,
const value_type& x)
104 vector_base::resize(new_size,x);
106 #elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,2) 108 void resize(size_type new_size,
const value_type& x)
111 vector_base::_M_erase_at_end(this->_M_impl._M_start + new_size);
118 void resize(size_type new_size,
const value_type& x)
121 vector_base::erase(vector_base::begin() + new_size, vector_base::end());
128 #endif // !EIGEN_HAS_CXX11_CONTAINERS 131 #endif // EIGEN_STDVECTOR_H
vector< EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T), Eigen::aligned_allocator_indirection< EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > vector_base
void resize(size_type new_size, const value_type &x)
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
#define EIGEN_STD_VECTOR_SPECIALIZATION_BODY
#define EIGEN_ALIGNED_ALLOCATOR
#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)
EIGEN_STD_VECTOR_SPECIALIZATION_BODY void resize(size_type new_size)