ReactOS 0.4.15-dev-7677-g8209aa5
valarray< _Tp > Class Template Reference

#include <_valarray.h>

Inheritance diagram for valarray< _Tp >:
Collaboration diagram for valarray< _Tp >:

Classes

struct  _NoInit
 

Public Types

typedef _Tp value_type
 

Public Member Functions

 valarray ()
 
 valarray (size_t __n)
 
 valarray (const value_type &__x, size_t __n)
 
 valarray (const value_type *__p, size_t __n)
 
 valarray (const valarray< _Tp > &__x)
 
 valarray (const slice_array< _Tp > &)
 
 valarray (const gslice_array< _Tp > &)
 
 valarray (const mask_array< _Tp > &)
 
 valarray (const indirect_array< _Tp > &)
 
 ~valarray ()
 
 valarray (size_t __n, _NoInit)
 
valarray< _Tp > & operator= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator= (const value_type &__x)
 
valarray< _Tp > & operator= (const slice_array< _Tp > &)
 
valarray< _Tp > & operator= (const gslice_array< _Tp > &)
 
valarray< _Tp > & operator= (const mask_array< _Tp > &)
 
valarray< _Tp > & operator= (const indirect_array< _Tp > &)
 
value_type operator[] (size_t __n) const
 
value_typeoperator[] (size_t __n)
 
size_t size () const
 
valarray< _Tp > operator[] (slice) const
 
slice_array< _Tp > operator[] (slice)
 
valarray< _Tp > operator[] (const gslice &) const
 
gslice_array< _Tp > operator[] (const gslice &)
 
valarray< _Tp > operator[] (const _Valarray_bool &) const
 
mask_array< _Tp > operator[] (const _Valarray_bool &)
 
valarray< _Tp > operator[] (const _Valarray_size_t &) const
 
indirect_array< _Tp > operator[] (const _Valarray_size_t &)
 
valarray< _Tp > operator+ () const
 
valarray< _Tp > operator- () const
 
valarray< _Tp > operator~ () const
 
_Valarray_bool operator! () const
 
valarray< _Tp > & operator*= (const value_type &__x)
 
valarray< _Tp > & operator/= (const value_type &__x)
 
valarray< _Tp > & operator%= (const value_type &__x)
 
valarray< _Tp > & operator+= (const value_type &__x)
 
valarray< _Tp > & operator-= (const value_type &__x)
 
valarray< _Tp > & operator^= (const value_type &__x)
 
valarray< _Tp > & operator&= (const value_type &__x)
 
valarray< _Tp > & operator|= (const value_type &__x)
 
valarray< _Tp > & operator<<= (const value_type &__x)
 
valarray< _Tp > & operator>>= (const value_type &__x)
 
valarray< _Tp > & operator*= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator/= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator%= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator+= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator-= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator^= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator&= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator|= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator<<= (const valarray< _Tp > &__x)
 
valarray< _Tp > & operator>>= (const valarray< _Tp > &__x)
 
value_type sum () const
 
value_type() min () const
 
value_type() max () const
 
valarray< _Tp > shift (int __n) const
 
valarray< _Tp > cshift (int __n) const
 
valarray< _Tp > apply (value_type __f(value_type)) const
 
valarray< _Tp > apply (value_type __f(const value_type &)) const
 
void resize (size_t __n, value_type __x=value_type())
 

Private Member Functions

void _M_initialize (const __true_type &)
 
void _M_initialize (const __false_type &)
 
- Private Member Functions inherited from _Valarray_base< _Tp >
 _Valarray_base ()
 
 _Valarray_base (size_t __n)
 
 ~_Valarray_base ()
 
void _M_allocate (size_t __n)
 
void _M_deallocate ()
 

Friends

class gslice
 

Additional Inherited Members

- Private Attributes inherited from _Valarray_base< _Tp >
_Tp * _M_first
 
size_t _M_size
 

Detailed Description

template<class _Tp>
class valarray< _Tp >

Definition at line 91 of file _valarray.h.

Member Typedef Documentation

◆ value_type

template<class _Tp >
typedef _Tp valarray< _Tp >::value_type

Definition at line 96 of file _valarray.h.

Constructor & Destructor Documentation

◆ valarray() [1/10]

template<class _Tp >
valarray< _Tp >::valarray ( )
inline

Definition at line 99 of file _valarray.h.

◆ valarray() [2/10]

template<class _Tp >
valarray< _Tp >::valarray ( size_t  __n)
inlineexplicit

Definition at line 100 of file _valarray.h.

return __n
Definition: _algo.h:75
#define _STLP_DEFAULT_CONSTRUCTED(_TTp)
Definition: _construct.h:265
_STLP_MOVE_TO_STD_NAMESPACE void uninitialized_fill_n(_ForwardIter __first, _Size __n, const _Tp &__x)
_Tp value_type
Definition: _valarray.h:96
_Tp * _M_first
Definition: _valarray.h:65
size_t _M_size
Definition: _valarray.h:66

◆ valarray() [3/10]

template<class _Tp >
valarray< _Tp >::valarray ( const value_type __x,
size_t  __n 
)
inline

Definition at line 102 of file _valarray.h.

103 { uninitialized_fill_n(this->_M_first, this->_M_size, __x); }

◆ valarray() [4/10]

template<class _Tp >
valarray< _Tp >::valarray ( const value_type __p,
size_t  __n 
)
inline

Definition at line 104 of file _valarray.h.

105 { uninitialized_copy(__p, __p + __n, this->_M_first); }
_STLP_MOVE_TO_STD_NAMESPACE _ForwardIter uninitialized_copy(_InputIter __first, _InputIter __last, _ForwardIter __result)

◆ valarray() [5/10]

template<class _Tp >
valarray< _Tp >::valarray ( const valarray< _Tp > &  __x)
inline

Definition at line 106 of file _valarray.h.

108 this->_M_first);
109 }

◆ valarray() [6/10]

template<class _Tp >
valarray< _Tp >::valarray ( const slice_array< _Tp > &  __x)
inline

Definition at line 1220 of file _valarray.h.

1223 _Is_Trivial;
1224 _M_initialize(_Is_Trivial());
1225 *this = __x;
1226}
slice _M_slice
Definition: _valarray.h:1208
size_t size() const
Definition: _valarray.h:1085
void _M_initialize(const __true_type &)
Definition: _valarray.h:123

◆ valarray() [7/10]

template<class _Tp >
valarray< _Tp >::valarray ( const gslice_array< _Tp > &  __x)
inline

Definition at line 1419 of file _valarray.h.

1422 _Is_Trivial;
1423 _M_initialize(_Is_Trivial());
1424 *this = __x;
1425}
gslice _M_gslice
Definition: _valarray.h:1405
size_t _M_size() const
Definition: _valarray.h:1258

◆ valarray() [8/10]

template<class _Tp >
valarray< _Tp >::valarray ( const mask_array< _Tp > &  __x)
inline

Definition at line 1543 of file _valarray.h.

1546 _Is_Trivial;
1547 _M_initialize(_Is_Trivial());
1548 *this = __x;
1549}
size_t _M_num_true() const
Definition: _valarray.h:1513

◆ valarray() [9/10]

template<class _Tp >
valarray< _Tp >::valarray ( const indirect_array< _Tp > &  __x)
inline

Definition at line 1659 of file _valarray.h.

1662 _Is_Trivial;
1663 _M_initialize(_Is_Trivial());
1664 *this = __x;
1665}
_Valarray_size_t _M_addr
Definition: _valarray.h:1647
size_t size() const
Definition: _valarray.h:164

◆ ~valarray()

template<class _Tp >
valarray< _Tp >::~valarray ( )
inline

Definition at line 118 of file _valarray.h.

118{ _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size); }

◆ valarray() [10/10]

template<class _Tp >
valarray< _Tp >::valarray ( size_t  __n,
_NoInit   
)
inline

Definition at line 129 of file _valarray.h.

130 typedef typename __type_traits<_Tp>::has_trivial_default_constructor _Is_Trivial;
131 _M_initialize(_Is_Trivial());
132 }

Member Function Documentation

◆ _M_initialize() [1/2]

template<class _Tp >
void valarray< _Tp >::_M_initialize ( const __false_type )
inlineprivate

Definition at line 124 of file _valarray.h.

◆ _M_initialize() [2/2]

template<class _Tp >
void valarray< _Tp >::_M_initialize ( const __true_type )
inlineprivate

Definition at line 123 of file _valarray.h.

123{}

Referenced by valarray< _Tp >::valarray().

◆ apply() [1/2]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::apply ( value_type   __fconst value_type &) const
inline

Definition at line 356 of file _valarray.h.

356 {
357 valarray<_Tp> __tmp(this->size());
358 transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
359 __f);
360 return __tmp;
361 }
GLuint GLenum GLenum transform
Definition: glext.h:9407

◆ apply() [2/2]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::apply ( value_type   __fvalue_type) const
inline

Definition at line 350 of file _valarray.h.

350 {
351 valarray<_Tp> __tmp(this->size());
352 transform(this->_M_first + 0, this->_M_first + this->_M_size, __tmp._M_first,
353 __f);
354 return __tmp;
355 }

◆ cshift()

template<class _Tp >
valarray< _Tp > valarray< _Tp >::cshift ( int  __n) const

Definition at line 165 of file _valarray.c.

165 {
166 valarray<_Tp> __tmp(this->size());
167
168 // Reduce __m to an equivalent number in the range [0, size()). We
169 // have to be careful with negative numbers, since the sign of a % b
170 // is unspecified when a < 0.
171 long __n = __m;
172 if (this->size() < (numeric_limits<long>::max)())
173 __n %= long(this->size());
174 if (__n < 0)
175 __n += this->size();
176
177 copy(this->_M_first, this->_M_first + __n,
178 __tmp._M_first + (this->size() - __n));
179 copy(this->_M_first + __n, this->_M_first + this->size(),
180 __tmp._M_first);
181
182 return __tmp;
183}
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51
#define long
Definition: qsort.c:33

◆ max()

template<class _Tp >
value_type() valarray< _Tp >::max ( ) const
inline

Definition at line 342 of file _valarray.h.

342 {
343 _STLP_ASSERT(this->size() != 0)
344 return *max_element(this->_M_first + 0, this->_M_first + this->_M_size);
345 }
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.c:1800
#define _STLP_ASSERT(expr)
Definition: _debug.h:165
return
Definition: dirsup.c:529

◆ min()

template<class _Tp >
value_type() valarray< _Tp >::min ( ) const
inline

Definition at line 337 of file _valarray.h.

337 {
338 _STLP_ASSERT(this->size() != 0)
339 return *min_element(this->_M_first + 0, this->_M_first + this->_M_size);
340 }
_ForwardIter min_element(_ForwardIter __first, _ForwardIter __last)
Definition: _algo.c:1828

◆ operator!()

template<class _Tp >
_STLP_BEGIN_NAMESPACE _Valarray_bool valarray< _Tp >::operator!

Definition at line 36 of file _valarray.c.

36 {
37 _Valarray_bool __tmp(this->size(), _Valarray_bool::_NoInit());
38 for (size_t __i = 0; __i < this->size(); ++__i)
39 __tmp[__i] = !(*this)[__i];
40 return __tmp;
41}

◆ operator%=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator%= ( const valarray< _Tp > &  __x)
inline

Definition at line 271 of file _valarray.h.

271 {
272 _STLP_ASSERT(__x.size() == this->size())
273 for (size_t __i = 0; __i < this->size(); ++__i)
274 (*this)[__i] %= __x[__i];
275 return *this;
276 }
GLsizeiptr size
Definition: glext.h:5919
#define for
Definition: utility.h:88

◆ operator%=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator%= ( const value_type __x)
inline

Definition at line 208 of file _valarray.h.

208 {
209 for (size_t __i = 0; __i < this->size(); ++__i)
210 (*this)[__i] %= __x;
211 return *this;
212 }

◆ operator&=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator&= ( const valarray< _Tp > &  __x)
inline

Definition at line 299 of file _valarray.h.

299 {
300 _STLP_ASSERT(__x.size() == this->size())
301 for (size_t __i = 0; __i < this->size(); ++__i)
302 (*this)[__i] &= __x[__i];
303 return *this;
304 }

◆ operator&=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator&= ( const value_type __x)
inline

Definition at line 232 of file _valarray.h.

232 {
233 for (size_t __i = 0; __i < this->size(); ++__i)
234 (*this)[__i] &= __x;
235 return *this;
236 }

◆ operator*=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator*= ( const valarray< _Tp > &  __x)
inline

Definition at line 257 of file _valarray.h.

257 {
258 _STLP_ASSERT(__x.size() == this->size())
259 for (size_t __i = 0; __i < this->size(); ++__i)
260 (*this)[__i] *= __x[__i];
261 return *this;
262 }

◆ operator*=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator*= ( const value_type __x)
inline

Definition at line 196 of file _valarray.h.

196 {
197 for (size_t __i = 0; __i < this->size(); ++__i)
198 (*this)[__i] *= __x;
199 return *this;
200 }

◆ operator+()

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator+ ( ) const
inline

Definition at line 177 of file _valarray.h.

177{ return *this; }

◆ operator+=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator+= ( const valarray< _Tp > &  __x)
inline

Definition at line 278 of file _valarray.h.

278 {
279 _STLP_ASSERT(__x.size() == this->size())
280 for (size_t __i = 0; __i < this->size(); ++__i)
281 (*this)[__i] += __x[__i];
282 return *this;
283 }

◆ operator+=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator+= ( const value_type __x)
inline

Definition at line 214 of file _valarray.h.

214 {
215 for (size_t __i = 0; __i < this->size(); ++__i)
216 (*this)[__i] += __x;
217 return *this;
218 }

◆ operator-()

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator- ( ) const
inline

Definition at line 179 of file _valarray.h.

179 {
180 valarray<_Tp> __tmp(this->size(), _NoInit());
181 for (size_t __i = 0; __i < this->size(); ++__i)
182 __tmp[__i] = -(*this)[__i];
183 return __tmp;
184 }

◆ operator-=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator-= ( const valarray< _Tp > &  __x)
inline

Definition at line 285 of file _valarray.h.

285 {
286 _STLP_ASSERT(__x.size() == this->size())
287 for (size_t __i = 0; __i < this->size(); ++__i)
288 (*this)[__i] -= __x[__i];
289 return *this;
290 }

◆ operator-=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator-= ( const value_type __x)
inline

Definition at line 220 of file _valarray.h.

220 {
221 for (size_t __i = 0; __i < this->size(); ++__i)
222 (*this)[__i] -= __x;
223 return *this;
224 }

◆ operator/=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator/= ( const valarray< _Tp > &  __x)
inline

Definition at line 264 of file _valarray.h.

264 {
265 _STLP_ASSERT(__x.size() == this->size())
266 for (size_t __i = 0; __i < this->size(); ++__i)
267 (*this)[__i] /= __x[__i];
268 return *this;
269 }

◆ operator/=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator/= ( const value_type __x)
inline

Definition at line 202 of file _valarray.h.

202 {
203 for (size_t __i = 0; __i < this->size(); ++__i)
204 (*this)[__i] /= __x;
205 return *this;
206 }

◆ operator<<=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator<<= ( const valarray< _Tp > &  __x)
inline

Definition at line 306 of file _valarray.h.

313 {
314 _STLP_ASSERT(__x.size() == this->size())
315 for (size_t __i = 0; __i < this->size(); ++__i)
316 (*this)[__i] <<= __x[__i];
317 return *this;
318 }

◆ operator<<=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator<<= ( const value_type __x)
inline

Definition at line 238 of file _valarray.h.

244 {
245 for (size_t __i = 0; __i < this->size(); ++__i)
246 (*this)[__i] <<= __x;
247 return *this;
248 }

◆ operator=() [1/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const gslice_array< _Tp > &  __x)

Definition at line 87 of file _valarray.c.

87 {
88 if (this->size() != 0) {
89 _Gslice_Iter __i(__x._M_gslice);
90 do
91 (*this)[__i._M_step] = __x._M_array[__i._M_1d_idx];
92 while(__i._M_incr());
93 }
94 return *this;
95}
valarray< value_type > & _M_array
Definition: _valarray.h:1406

◆ operator=() [2/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const indirect_array< _Tp > &  __x)

Definition at line 126 of file _valarray.c.

126 {
127 _STLP_ASSERT(__x._M_addr.size() == this->size())
128 for (size_t __i = 0; __i < __x._M_addr.size(); ++__i)
129 (*this)[__i] = __x._M_array[__x._M_addr[__i]];
130 return *this;
131}

◆ operator=() [3/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const mask_array< _Tp > &  __x)
inline

Definition at line 1553 of file _valarray.h.

1553 {
1554 size_t __idx = 0;
1555 for (size_t __i = 0; __i < __x._M_array.size(); ++__i)
1556 if (__x._M_mask[__i]) (*this)[__idx++] = __x._M_array[__i];
1557 return *this;
1558}
_Valarray_bool _M_mask
Definition: _valarray.h:1531
valarray< _Tp > & _M_array
Definition: _valarray.h:1532

◆ operator=() [4/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const slice_array< _Tp > &  __x)

Definition at line 45 of file _valarray.c.

45 {
46 _STLP_ASSERT(__x._M_slice.size() == this->size())
47 size_t __index = __x._M_slice.start();
48 for (size_t __i = 0;
49 __i < __x._M_slice.size();
50 ++__i, __index += __x._M_slice.stride())
51 (*this)[__i] = __x._M_array[__index];
52 return *this;
53}
__kernel_size_t size_t
Definition: linux.h:237
GLuint start
Definition: gl.h:1545
GLsizei stride
Definition: glext.h:5848

◆ operator=() [5/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const valarray< _Tp > &  __x)
inline

Definition at line 136 of file _valarray.h.

136 {
137 _STLP_ASSERT(__x.size() == this->size())
138 if (this != &__x)
139 copy(__x._M_first, __x._M_first + __x._M_size, this->_M_first);
140 return *this;
141 }
if(dx< 0)
Definition: linetemp.h:194

◆ operator=() [6/6]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator= ( const value_type __x)
inline

Definition at line 144 of file _valarray.h.

144 {
145 fill_n(this->_M_first, this->_M_size, __x);
146 return *this;
147 }
_STLP_MOVE_TO_STD_NAMESPACE void fill_n(_OutputIter __first, _Size __n, const _Tp &__val)
Definition: _algobase.h:511

◆ operator>>=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator>>= ( const valarray< _Tp > &  __x)
inline

Definition at line 320 of file _valarray.h.

320 {
321 _STLP_ASSERT(__x.size() == this->size())
322 for (size_t __i = 0; __i < this->size(); ++__i)
323 (*this)[__i] >>= __x[__i];
324 return *this;
325 }

◆ operator>>=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator>>= ( const value_type __x)
inline

Definition at line 250 of file _valarray.h.

250 {
251 for (size_t __i = 0; __i < this->size(); ++__i)
252 (*this)[__i] >>= __x;
253 return *this;
254 }

◆ operator[]() [1/10]

template<class _Tp >
mask_array< _Tp > valarray< _Tp >::operator[] ( const _Valarray_bool __mask)
inline

Definition at line 1561 of file _valarray.h.

1561 {
1562 _STLP_ASSERT(__mask.size() == this->size())
1563 return mask_array<_Tp>(__mask, *this);
1564}

◆ operator[]() [2/10]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator[] ( const _Valarray_bool __mask) const

Definition at line 108 of file _valarray.c.

108 {
109 size_t _p_size = 0;
110 {
111 for (size_t __i = 0; __i < __mask.size(); ++__i)
112 if (__mask[__i]) ++_p_size;
113 }
114
115 valarray<_Tp> __tmp(_p_size, _NoInit());
116 size_t __idx = 0;
117 {
118 for (size_t __i = 0; __i < __mask.size(); ++__i)
119 if (__mask[__i]) __tmp[__idx++] = (*this)[__i];
120 }
121
122 return __tmp;
123}

◆ operator[]() [3/10]

template<class _Tp >
indirect_array< _Tp > valarray< _Tp >::operator[] ( const _Valarray_size_t __addr)
inline

Definition at line 1670 of file _valarray.h.

1671{ return indirect_array<_Tp>(__addr, *this); }

◆ operator[]() [4/10]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator[] ( const _Valarray_size_t __addr) const

Definition at line 135 of file _valarray.c.

135 {
136 valarray<_Tp> __tmp(__addr.size(), _NoInit());
137 for (size_t __i = 0; __i < __addr.size(); ++__i)
138 __tmp[__i] = (*this)[__addr[__i]];
139 return __tmp;
140}

◆ operator[]() [5/10]

template<class _Tp >
gslice_array< _Tp > valarray< _Tp >::operator[] ( const gslice __slice)
inline

Definition at line 1428 of file _valarray.h.

1429{ return gslice_array<_Tp>(__slice, *this); }

◆ operator[]() [6/10]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator[] ( const gslice __slice) const

Definition at line 98 of file _valarray.c.

98 {
99 valarray<_Tp> __tmp(__slice._M_size(), _NoInit());
100 if (__tmp.size() != 0) {
101 _Gslice_Iter __i(__slice);
102 do __tmp[__i._M_step] = (*this)[__i._M_1d_idx]; while(__i._M_incr());
103 }
104 return __tmp;
105}

◆ operator[]() [7/10]

template<class _Tp >
value_type & valarray< _Tp >::operator[] ( size_t  __n)
inline

Definition at line 160 of file _valarray.h.

160 {
161 _STLP_ASSERT(__n < this->size())
162 return this->_M_first[__n];
163 }

◆ operator[]() [8/10]

template<class _Tp >
value_type valarray< _Tp >::operator[] ( size_t  __n) const
inline

Definition at line 156 of file _valarray.h.

156 {
157 _STLP_ASSERT(__n < this->size())
158 return this->_M_first[__n];
159 }

◆ operator[]() [9/10]

template<class _Tp >
slice_array< _Tp > valarray< _Tp >::operator[] ( slice  __slice)
inline

Definition at line 1230 of file _valarray.h.

1231{ return slice_array<_Tp>(__slice, *this); }

◆ operator[]() [10/10]

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator[] ( slice  __slice) const

Definition at line 56 of file _valarray.c.

56 {
57 valarray<_Tp> __tmp(__slice.size(), _NoInit());
58 size_t __index = __slice.start();
59 for (size_t __i = 0;
60 __i < __slice.size();
61 ++__i, __index += __slice.stride())
62 __tmp[__i] = (*this)[__index];
63 return __tmp;
64}
size_t start() const
Definition: _valarray.h:1084
size_t stride() const
Definition: _valarray.h:1086

◆ operator^=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator^= ( const valarray< _Tp > &  __x)
inline

Definition at line 292 of file _valarray.h.

292 {
293 _STLP_ASSERT(__x.size() == this->size())
294 for (size_t __i = 0; __i < this->size(); ++__i)
295 (*this)[__i] ^= __x[__i];
296 return *this;
297 }

◆ operator^=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator^= ( const value_type __x)
inline

Definition at line 226 of file _valarray.h.

226 {
227 for (size_t __i = 0; __i < this->size(); ++__i)
228 (*this)[__i] ^= __x;
229 return *this;
230 }

◆ operator|=() [1/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator|= ( const valarray< _Tp > &  __x)
inline

Definition at line 306 of file _valarray.h.

306 {
307 _STLP_ASSERT(__x.size() == this->size())
308 for (size_t __i = 0; __i < this->size(); ++__i)
309 (*this)[__i] |= __x[__i];
310 return *this;
311 }

◆ operator|=() [2/2]

template<class _Tp >
valarray< _Tp > & valarray< _Tp >::operator|= ( const value_type __x)
inline

Definition at line 238 of file _valarray.h.

238 {
239 for (size_t __i = 0; __i < this->size(); ++__i)
240 (*this)[__i] |= __x;
241 return *this;
242 }

◆ operator~()

template<class _Tp >
valarray< _Tp > valarray< _Tp >::operator~ ( ) const
inline

Definition at line 186 of file _valarray.h.

186 {
187 valarray<_Tp> __tmp(this->size(), _NoInit());
188 for (size_t __i = 0; __i < this->size(); ++__i)
189 __tmp[__i] = ~(*this)[__i];
190 return __tmp;
191 }

◆ resize()

template<class _Tp >
void valarray< _Tp >::resize ( size_t  __n,
value_type  __x = value_type() 
)
inline

Definition at line 363 of file _valarray.h.

363 {
364 _STLP_STD::_Destroy_Range(this->_M_first, this->_M_first + this->_M_size);
367 uninitialized_fill_n(this->_M_first, this->_M_size, __x);
368 }
void _M_deallocate()
Definition: _valarray.h:83
void _M_allocate(size_t __n)
Definition: _valarray.h:72

◆ shift()

template<class _Tp >
valarray< _Tp > valarray< _Tp >::shift ( int  __n) const

Definition at line 148 of file _valarray.c.

148 {
149 valarray<_Tp> __tmp(this->size());
150
151 if (__n >= 0) {
152 if (__n < this->size())
153 copy(this->_M_first + __n, this->_M_first + this->size(),
154 __tmp._M_first);
155 }
156 else {
157 if (-__n < this->size())
158 copy(this->_M_first, this->_M_first + this->size() + __n,
159 __tmp._M_first - __n);
160 }
161 return __tmp;
162}

◆ size()

◆ sum()

template<class _Tp >
value_type valarray< _Tp >::sum ( ) const
inline

Definition at line 330 of file _valarray.h.

330 {
331 _STLP_ASSERT(this->size() != 0)
332 return accumulate(this->_M_first + 1, this->_M_first + this->_M_size,
333 (*this)[0]);
334 }
_STLP_BEGIN_NAMESPACE _STLP_INLINE_LOOP _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp _Init)
Definition: _numeric.h:42

Friends And Related Function Documentation

◆ gslice

template<class _Tp >
friend class gslice
friend

Definition at line 93 of file _valarray.h.


The documentation for this class was generated from the following files: