1 // { dg-do compile { target i?86-*-* x86_64-*-* } }
2 // { dg-options "-O3 -mxop" }
4 typedef long unsigned int size_t;
5 typedef unsigned long ulong_t;
6 typedef signed long slong_t;
8 template<typename _Iterator>
11 typedef typename _Iterator::reference reference;
14 template<typename _Tp>
15 struct iterator_traits<_Tp*>
17 typedef _Tp& reference;
20 template<typename _Iterator, typename _Container>
21 class __normal_iterator
25 typedef iterator_traits<_Iterator> __traits_type;
28 typedef typename __traits_type::reference reference;
31 __normal_iterator(const _Iterator& __i) : _M_current(__i) { }
35 { return *_M_current; }
46 { return _M_current; }
49 template<typename _Iterator, typename _Container>
51 operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
52 const __normal_iterator<_Iterator, _Container>& __rhs)
53 { return __lhs.base() != __rhs.base(); }
55 template<typename _Tp>
60 typedef _Tp value_type;
62 template<typename _Tp1>
64 { typedef allocator<_Tp1> other; };
66 pointer allocate(size_t __n, const void* = 0)
68 return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp)));
72 template<typename _Tp, typename _Alloc>
75 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
78 : public _Tp_alloc_type
80 typename _Tp_alloc_type::pointer _M_start;
81 typename _Tp_alloc_type::pointer _M_finish;
82 typename _Tp_alloc_type::pointer _M_end_of_storage;
84 _Vector_impl(_Tp_alloc_type const& __a) { }
88 typedef _Alloc allocator_type;
90 _Vector_base(size_t __n, const allocator_type& __a)
93 this->_M_impl._M_start = this->_M_allocate(__n);
94 this->_M_impl._M_finish = this->_M_impl._M_start;
95 this->_M_impl._M_end_of_storage = this->_M_impl._M_start + __n;
101 typename _Tp_alloc_type::pointer
102 _M_allocate(size_t __n)
103 { return __n != 0 ? _M_impl.allocate(__n) : 0; }
107 template<typename _Tp, typename _Alloc = allocator<_Tp> >
108 class vector : protected _Vector_base<_Tp, _Alloc>
110 typedef _Vector_base<_Tp, _Alloc> _Base;
111 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
114 typedef _Tp value_type;
115 typedef typename _Tp_alloc_type::pointer pointer;
116 typedef __normal_iterator<pointer, vector> iterator;
117 typedef _Alloc allocator_type;
120 using _Base::_M_allocate;
121 using _Base::_M_impl;
126 vector(size_t __n, const value_type& __value = value_type(),
127 const allocator_type& __a = allocator_type())
129 { _M_fill_initialize(__n, __value); }
132 { return iterator(this->_M_impl._M_start); }
135 { return iterator(this->_M_impl._M_finish); }
139 _M_fill_initialize(size_t __n, const value_type& __value)
141 this->_M_impl._M_finish = this->_M_impl._M_end_of_storage;
145 template<typename _InputIterator, typename _OutputIterator, typename _Tp>
147 replace_copy(_InputIterator __first, _InputIterator __last,
148 _OutputIterator __result,
149 const _Tp& __old_value, const _Tp& __new_value)
152 for (; __first != __last; ++__first, ++__result)
153 if (*__first == __old_value)
154 *__result = __new_value;
156 *__result = *__first;
160 extern size_t shape_rank;
162 void createDataspaceIdentifier()
164 vector< ulong_t > dataspaceDims( shape_rank );
165 vector< ulong_t > maxDataspaceDims( shape_rank );
168 dataspaceDims.begin(), dataspaceDims.end(),
169 maxDataspaceDims.begin(), ulong_t( 0 ), ((ulong_t)(slong_t)(-1)) );