10 #ifndef EIGEN_STDLIST_H
11 #define EIGEN_STDLIST_H
16 #if defined(__INTEL_COMPILER) || defined(__GNUC__)
17 #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...) template class std::list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> >;
19 #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...)
27 #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) \
28 EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(__VA_ARGS__) \
31 template<typename _Ay> \
32 class list<__VA_ARGS__, _Ay> \
33 : public list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \
35 typedef list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > list_base; \
37 typedef __VA_ARGS__ value_type; \
38 typedef typename list_base::allocator_type allocator_type; \
39 typedef typename list_base::size_type size_type; \
40 typedef typename list_base::iterator iterator; \
41 explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \
42 template<typename InputIterator> \
43 list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : list_base(first, last, a) {} \
44 list(const list& c) : list_base(c) {} \
45 explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \
46 list(iterator start, iterator end) : list_base(start, end) {} \
47 list& operator=(const list& x) { \
48 list_base::operator=(x); \
55 #if !(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1)))
60 #define EIGEN_STD_LIST_SPECIALIZATION_BODY \
62 typedef T value_type; \
63 typedef typename list_base::allocator_type allocator_type; \
64 typedef typename list_base::size_type size_type; \
65 typedef typename list_base::iterator iterator; \
66 typedef typename list_base::const_iterator const_iterator; \
67 explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \
68 template<typename InputIterator> \
69 list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \
70 : list_base(first, last, a) {} \
71 list(const list& c) : list_base(c) {} \
72 explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \
73 list(iterator start, iterator end) : list_base(start, end) {} \
74 list& operator=(const list& x) { \
75 list_base::operator=(x); \
80 class list<T,EIGEN_ALIGNED_ALLOCATOR<T> >
81 :
public list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
82 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> >
84 typedef list<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T),
85 Eigen::aligned_allocator_indirection<EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T)> > list_base;
86 EIGEN_STD_LIST_SPECIALIZATION_BODY
88 void resize(size_type new_size)
89 { resize(new_size, T()); }
91 void resize(size_type new_size,
const value_type& x)
93 if (list_base::size() < new_size)
94 list_base::insert(list_base::end(), new_size - list_base::size(), x);
96 while (new_size < list_base::size()) list_base::pop_back();
101 void push_back(
const value_type& x)
102 { list_base::push_back(x); }
103 using list_base::insert;
104 iterator insert(const_iterator position,
const value_type& x)
105 {
return list_base::insert(position,x); }
106 void insert(const_iterator position, size_type new_size,
const value_type& x)
107 { list_base::insert(position, new_size, x); }
112 #endif // check whether specialization is actually required
114 #endif // EIGEN_STDLIST_H