Warning, file /include/eigen3/Eigen/src/StlSupport/StdVector.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef EIGEN_STDVECTOR_H
0012 #define EIGEN_STDVECTOR_H
0013
0014 #include "details.h"
0015
0016
0017
0018
0019
0020
0021 #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \
0022 namespace std \
0023 { \
0024 template<> \
0025 class vector<__VA_ARGS__, std::allocator<__VA_ARGS__> > \
0026 : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \
0027 { \
0028 typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \
0029 public: \
0030 typedef __VA_ARGS__ value_type; \
0031 typedef vector_base::allocator_type allocator_type; \
0032 typedef vector_base::size_type size_type; \
0033 typedef vector_base::iterator iterator; \
0034 explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \
0035 template<typename InputIterator> \
0036 vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : vector_base(first, last, a) {} \
0037 vector(const vector& c) : vector_base(c) {} \
0038 explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \
0039 vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \
0040 vector& operator=(const vector& x) { \
0041 vector_base::operator=(x); \
0042 return *this; \
0043 } \
0044 }; \
0045 }
0046
0047
0048 #if !EIGEN_HAS_CXX11_CONTAINERS
0049
0050 namespace std {
0051
0052 #define EIGEN_STD_VECTOR_SPECIALIZATION_BODY \
0053 public: \
0054 typedef T value_type; \
0055 typedef typename vector_base::allocator_type allocator_type; \
0056 typedef typename vector_base::size_type size_type; \
0057 typedef typename vector_base::iterator iterator; \
0058 typedef typename vector_base::const_iterator const_iterator; \
0059 explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \
0060 template<typename InputIterator> \
0061 vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \
0062 : vector_base(first, last, a) {} \
0063 vector(const vector& c) : vector_base(c) {} \
0064 explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \
0065 vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \
0066 vector& operator=(const vector& x) { \
0067 vector_base::operator=(x); \
0068 return *this; \
0069 }
0070
0071 template<typename T>
0072 class vector<T,EIGEN_ALIGNED_ALLOCATOR<T> >
0073 : public vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
0074 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
0075 {
0076 typedef vector<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
0077 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > vector_base;
0078 EIGEN_STD_VECTOR_SPECIALIZATION_BODY
0079
0080 void resize(size_type new_size)
0081 { resize(new_size, T()); }
0082
0083 #if defined(_VECTOR_)
0084
0085 void resize(size_type new_size, const value_type& x)
0086 {
0087 if (vector_base::size() < new_size)
0088 vector_base::_Insert_n(vector_base::end(), new_size - vector_base::size(), x);
0089 else if (new_size < vector_base::size())
0090 vector_base::erase(vector_base::begin() + new_size, vector_base::end());
0091 }
0092 void push_back(const value_type& x)
0093 { vector_base::push_back(x); }
0094 using vector_base::insert;
0095 iterator insert(const_iterator position, const value_type& x)
0096 { return vector_base::insert(position,x); }
0097 void insert(const_iterator position, size_type new_size, const value_type& x)
0098 { vector_base::insert(position, new_size, x); }
0099 #elif defined(_GLIBCXX_VECTOR) && (!(EIGEN_GNUC_AT_LEAST(4,1)))
0100
0101
0102 void resize(size_type new_size, const value_type& x)
0103 {
0104 vector_base::resize(new_size,x);
0105 }
0106 #elif defined(_GLIBCXX_VECTOR) && EIGEN_GNUC_AT_LEAST(4,2)
0107
0108 void resize(size_type new_size, const value_type& x)
0109 {
0110 if (new_size < vector_base::size())
0111 vector_base::_M_erase_at_end(this->_M_impl._M_start + new_size);
0112 else
0113 vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
0114 }
0115 #else
0116
0117
0118 void resize(size_type new_size, const value_type& x)
0119 {
0120 if (new_size < vector_base::size())
0121 vector_base::erase(vector_base::begin() + new_size, vector_base::end());
0122 else if (new_size > vector_base::size())
0123 vector_base::insert(vector_base::end(), new_size - vector_base::size(), x);
0124 }
0125 #endif
0126 };
0127 }
0128 #endif
0129
0130
0131 #endif