33 #ifndef _GLIBCXX_VALARRAY
34 #define _GLIBCXX_VALARRAY 1
36 #pragma GCC system_header
42 #ifdef __GXX_EXPERIMENTAL_CXX0X__
46 namespace std _GLIBCXX_VISIBILITY(default)
48 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50 template<
class _Clos,
typename _Tp>
53 template<
typename _Tp1,
typename _Tp2>
56 template<
class _Oper,
template<
class,
class>
class _Meta,
class _Dom>
60 template<
class,
class>
class _Meta1,
61 template<
class,
class>
class _Meta2,
62 class _Dom1,
class _Dom2>
65 template<
template<
class,
class>
class _Meta,
class _Dom>
68 template<
template<
class,
class>
class _Meta,
class _Dom>
71 template<
template<
class,
class>
class _Meta,
class _Dom>
74 template<
template<
class,
class>
class _Meta,
class _Dom>
77 template<
template<
class,
class>
class _Meta,
class _Dom>
88 _GLIBCXX_END_NAMESPACE_VERSION
94 namespace std _GLIBCXX_VISIBILITY(default)
96 _GLIBCXX_BEGIN_NAMESPACE_VERSION
123 typedef typename __fun<_Op, _Tp>::result_type __rt;
124 typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt;
127 typedef _Tp value_type;
140 valarray(
const _Tp* __restrict__,
size_t);
145 #ifdef __GXX_EXPERIMENTAL_CXX0X__
160 valarray(
const indirect_array<_Tp>&);
162 #ifdef __GXX_EXPERIMENTAL_CXX0X__
168 valarray(
const _Expr<_Dom, _Tp>& __e);
182 #ifdef __GXX_EXPERIMENTAL_CXX0X__
190 valarray<_Tp>&
operator=(valarray<_Tp>&& __v) noexcept;
200 valarray<_Tp>&
operator=(
const _Tp& __t);
210 valarray<_Tp>&
operator=(
const slice_array<_Tp>& __sa);
220 valarray<_Tp>&
operator=(
const gslice_array<_Tp>& __ga);
230 valarray<_Tp>&
operator=(
const mask_array<_Tp>& __ma);
240 valarray<_Tp>&
operator=(
const indirect_array<_Tp>& __ia);
242 #ifdef __GXX_EXPERIMENTAL_CXX0X__
254 template<
class _Dom> valarray<_Tp>&
281 _Expr<_SClos<_ValArray, _Tp>, _Tp>
operator[](slice __s)
const;
304 _Expr<_GClos<_ValArray, _Tp>, _Tp>
operator[](
const gslice& __s)
const;
316 gslice_array<_Tp>
operator[](
const gslice& __s);
330 valarray<_Tp>
operator[](
const valarray<bool>& __m)
const;
344 mask_array<_Tp>
operator[](
const valarray<bool>& __m);
357 _Expr<_IClos<_ValArray, _Tp>, _Tp>
358 operator[](
const valarray<size_t>& __i)
const;
372 indirect_array<_Tp>
operator[](
const valarray<size_t>& __i);
376 typename _UnaryOp<__unary_plus>::_Rt
operator+()
const;
379 typename _UnaryOp<__negate>::_Rt
operator-()
const;
382 typename _UnaryOp<__bitwise_not>::_Rt
operator~()
const;
385 typename _UnaryOp<__logical_not>::_Rt
operator!()
const;
419 valarray<_Tp>&
operator*=(
const valarray<_Tp>&);
422 valarray<_Tp>&
operator/=(
const valarray<_Tp>&);
425 valarray<_Tp>&
operator%=(
const valarray<_Tp>&);
428 valarray<_Tp>&
operator+=(
const valarray<_Tp>&);
431 valarray<_Tp>&
operator-=(
const valarray<_Tp>&);
434 valarray<_Tp>&
operator^=(
const valarray<_Tp>&);
437 valarray<_Tp>&
operator|=(
const valarray<_Tp>&);
440 valarray<_Tp>&
operator&=(
const valarray<_Tp>&);
443 valarray<_Tp>& operator<<=(const valarray<_Tp>&);
449 valarray<_Tp>&
operator*=(
const _Expr<_Dom, _Tp>&);
451 valarray<_Tp>&
operator/=(
const _Expr<_Dom, _Tp>&);
453 valarray<_Tp>&
operator%=(
const _Expr<_Dom, _Tp>&);
455 valarray<_Tp>&
operator+=(
const _Expr<_Dom, _Tp>&);
457 valarray<_Tp>&
operator-=(
const _Expr<_Dom, _Tp>&);
459 valarray<_Tp>&
operator^=(
const _Expr<_Dom, _Tp>&);
461 valarray<_Tp>&
operator|=(
const _Expr<_Dom, _Tp>&);
463 valarray<_Tp>&
operator&=(
const _Expr<_Dom, _Tp>&);
465 valarray<_Tp>& operator<<=(const _Expr<_Dom, _Tp>&);
467 valarray<_Tp>&
operator>>=(
const _Expr<_Dom, _Tp>&);
470 #ifdef __GXX_EXPERIMENTAL_CXX0X__
472 void swap(valarray<_Tp>& __v) noexcept;
507 valarray<_Tp>
shift (
int __n)
const;
524 valarray<_Tp>
cshift(
int __n)
const;
536 _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
apply(_Tp func(_Tp))
const;
548 _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
apply(_Tp func(
const _Tp&))
const;
559 void resize(
size_t __size, _Tp __c = _Tp());
563 _Tp* __restrict__ _M_data;
565 friend class _Array<_Tp>;
568 template<
typename _Tp>
572 __glibcxx_requires_subscript(__i);
576 template<
typename _Tp>
580 __glibcxx_requires_subscript(__i);
586 _GLIBCXX_END_NAMESPACE_VERSION
596 namespace std _GLIBCXX_VISIBILITY(default)
598 _GLIBCXX_BEGIN_NAMESPACE_VERSION
605 template<
typename _Tp>
609 template<
typename _Tp>
612 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
613 { std::__valarray_default_construct(_M_data, _M_data + __n); }
615 template<
typename _Tp>
618 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
619 { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); }
621 template<
typename _Tp>
624 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
626 _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0);
627 std::__valarray_copy_construct(__p, __p + __n, _M_data);
630 template<
typename _Tp>
633 : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))
634 { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
637 #ifdef __GXX_EXPERIMENTAL_CXX0X__
638 template<
typename _Tp>
641 : _M_size(__v._M_size), _M_data(__v._M_data)
648 template<
typename _Tp>
651 : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))
653 std::__valarray_copy_construct
654 (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));
657 template<
typename _Tp>
660 : _M_size(__ga._M_index.
size()),
661 _M_data(__valarray_get_storage<_Tp>(_M_size))
663 std::__valarray_copy_construct
664 (__ga._M_array, _Array<size_t>(__ga._M_index),
665 _Array<_Tp>(_M_data), _M_size);
668 template<
typename _Tp>
671 : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))
673 std::__valarray_copy_construct
674 (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);
677 template<
typename _Tp>
680 : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz))
682 std::__valarray_copy_construct
683 (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
686 #ifdef __GXX_EXPERIMENTAL_CXX0X__
687 template<
typename _Tp>
690 : _M_size(__l.
size()), _M_data(__valarray_get_storage<_Tp>(__l.
size()))
691 { std::__valarray_copy_construct(__l.begin(), __l.end(), _M_data); }
694 template<
typename _Tp>
template<
class _Dom>
697 : _M_size(__e.
size()), _M_data(__valarray_get_storage<_Tp>(_M_size))
698 { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); }
700 template<
typename _Tp>
702 valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT
704 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
705 std::__valarray_release_memory(_M_data);
708 template<
typename _Tp>
709 inline valarray<_Tp>&
714 if (_M_size == __v._M_size)
715 std::__valarray_copy(__v._M_data, _M_size, _M_data);
720 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
721 std::__valarray_release_memory(_M_data);
723 _M_size = __v._M_size;
724 _M_data = __valarray_get_storage<_Tp>(_M_size);
725 std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
731 #ifdef __GXX_EXPERIMENTAL_CXX0X__
732 template<
typename _Tp>
738 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
739 std::__valarray_release_memory(_M_data);
741 _M_size = __v._M_size;
742 _M_data = __v._M_data;
748 template<
typename _Tp>
754 if (_M_size == __l.size())
755 std::__valarray_copy(__l.begin(), __l.size(), _M_data);
760 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
761 std::__valarray_release_memory(_M_data);
763 _M_size = __l.size();
764 _M_data = __valarray_get_storage<_Tp>(_M_size);
765 std::__valarray_copy_construct(__l.begin(), __l.begin() + _M_size,
772 template<
typename _Tp>
776 std::__valarray_fill(_M_data, _M_size, __t);
780 template<
typename _Tp>
784 _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz);
785 std::__valarray_copy(__sa._M_array, __sa._M_sz,
786 __sa._M_stride, _Array<_Tp>(_M_data));
790 template<
typename _Tp>
794 _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.
size());
795 std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index),
796 _Array<_Tp>(_M_data), _M_size);
800 template<
typename _Tp>
804 _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz);
805 std::__valarray_copy(__ma._M_array, __ma._M_mask,
806 _Array<_Tp>(_M_data), _M_size);
810 template<
typename _Tp>
814 _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz);
815 std::__valarray_copy(__ia._M_array, __ia._M_index,
816 _Array<_Tp>(_M_data), _M_size);
820 template<
typename _Tp>
template<
class _Dom>
824 _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size());
825 std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data));
829 template<
typename _Tp>
830 inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
833 typedef _SClos<_ValArray,_Tp> _Closure;
834 return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s));
837 template<
typename _Tp>
842 template<
typename _Tp>
843 inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
846 typedef _GClos<_ValArray,_Tp> _Closure;
847 return _Expr<_Closure, _Tp>
848 (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index));
851 template<
typename _Tp>
856 (_Array<_Tp>(_M_data), __gs._M_index->_M_index);
859 template<
typename _Tp>
864 size_t __e = __m.
size();
865 for (
size_t __i=0; __i<__e; ++__i)
868 _Array<bool> (__m)));
871 template<
typename _Tp>
876 size_t __e = __m.
size();
877 for (
size_t __i=0; __i<__e; ++__i)
882 template<
typename _Tp>
883 inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
886 typedef _IClos<_ValArray,_Tp> _Closure;
887 return _Expr<_Closure, _Tp>(_Closure(*
this, __i));
890 template<
typename _Tp>
895 _Array<size_t>(__i));
898 #ifdef __GXX_EXPERIMENTAL_CXX0X__
903 std::swap(_M_size, __v._M_size);
904 std::swap(_M_data, __v._M_data);
917 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
918 return std::__valarray_sum(_M_data, _M_data + _M_size);
930 _Tp* __restrict__ __tmp_M_data =
931 std::__valarray_get_storage<_Tp>(_M_size);
934 std::__valarray_copy_construct(_M_data,
935 _M_data + _M_size, __tmp_M_data);
938 if (
size_t(__n) > _M_size)
941 std::__valarray_copy_construct(_M_data + __n,
942 _M_data + _M_size, __tmp_M_data);
943 std::__valarray_default_construct(__tmp_M_data + _M_size - __n,
944 __tmp_M_data + _M_size);
948 if (-
size_t(__n) > _M_size)
951 std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
953 std::__valarray_default_construct(__tmp_M_data,
957 __ret._M_size = _M_size;
958 __ret._M_data = __tmp_M_data;
971 _Tp* __restrict__ __tmp_M_data =
972 std::__valarray_get_storage<_Tp>(_M_size);
975 std::__valarray_copy_construct(_M_data,
976 _M_data + _M_size, __tmp_M_data);
979 if (
size_t(__n) > _M_size)
980 __n = int(__n % _M_size);
982 std::__valarray_copy_construct(_M_data, _M_data + __n,
983 __tmp_M_data + _M_size - __n);
984 std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size,
989 if (-
size_t(__n) > _M_size)
990 __n = -int(-
size_t(__n) % _M_size);
992 std::__valarray_copy_construct(_M_data + _M_size + __n,
993 _M_data + _M_size, __tmp_M_data);
994 std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
998 __ret._M_size = _M_size;
999 __ret._M_data = __tmp_M_data;
1010 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
1013 std::__valarray_release_memory(_M_data);
1015 _M_data = __valarray_get_storage<_Tp>(__n);
1017 std::__valarray_fill_construct(_M_data, _M_data + __n, __c);
1020 template<
typename _Tp>
1024 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
1028 template<
typename _Tp>
1032 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
1037 inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
1040 typedef _ValFunClos<_ValArray, _Tp> _Closure;
1041 return _Expr<_Closure, _Tp>(_Closure(*
this, func));
1045 inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
1048 typedef _RefFunClos<_ValArray, _Tp> _Closure;
1049 return _Expr<_Closure, _Tp>(_Closure(*
this, func));
1052 #define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
1053 template<typename _Tp> \
1054 inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \
1055 valarray<_Tp>::operator _Op() const \
1057 typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \
1058 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1059 return _Expr<_Closure, _Rt>(_Closure(*this)); \
1062 _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus)
1063 _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate)
1064 _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not)
1065 _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not)
1067 #undef _DEFINE_VALARRAY_UNARY_OPERATOR
1069 #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
1070 template<class _Tp> \
1071 inline valarray<_Tp>& \
1072 valarray<_Tp>::operator _Op##=(const _Tp &__t) \
1074 _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \
1078 template<class _Tp> \
1079 inline valarray<_Tp>& \
1080 valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \
1082 _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \
1083 _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \
1084 _Array<_Tp>(__v._M_data)); \
1088 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)
1089 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)
1090 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)
1091 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)
1092 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)
1093 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
1094 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
1095 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
1096 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)
1097 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)
1099 #undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
1101 #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
1102 template<class _Tp> template<class _Dom> \
1103 inline valarray<_Tp>& \
1104 valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \
1106 _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \
1110 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)
1111 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)
1112 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)
1113 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)
1114 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)
1115 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
1116 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
1117 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
1118 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)
1119 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)
1121 #undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
1124 #define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
1125 template<typename _Tp> \
1126 inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \
1127 typename __fun<_Name, _Tp>::result_type> \
1128 operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
1130 _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \
1131 typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
1132 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1133 return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \
1136 template<typename _Tp> \
1137 inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \
1138 typename __fun<_Name, _Tp>::result_type> \
1139 operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \
1141 typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \
1142 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1143 return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \
1146 template<typename _Tp> \
1147 inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \
1148 typename __fun<_Name, _Tp>::result_type> \
1149 operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \
1151 typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \
1152 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1153 return _Expr<_Closure, _Rt>(_Closure(__t, __v)); \
1156 _DEFINE_BINARY_OPERATOR(+, __plus)
1157 _DEFINE_BINARY_OPERATOR(-, __minus)
1158 _DEFINE_BINARY_OPERATOR(*, __multiplies)
1159 _DEFINE_BINARY_OPERATOR(/, __divides)
1160 _DEFINE_BINARY_OPERATOR(%, __modulus)
1161 _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
1162 _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
1163 _DEFINE_BINARY_OPERATOR(|, __bitwise_or)
1164 _DEFINE_BINARY_OPERATOR(<<, __shift_left)
1165 _DEFINE_BINARY_OPERATOR(>>, __shift_right)
1166 _DEFINE_BINARY_OPERATOR(&&, __logical_and)
1167 _DEFINE_BINARY_OPERATOR(||, __logical_or)
1168 _DEFINE_BINARY_OPERATOR(==, __equal_to)
1169 _DEFINE_BINARY_OPERATOR(!=, __not_equal_to)
1170 _DEFINE_BINARY_OPERATOR(<, __less)
1171 _DEFINE_BINARY_OPERATOR(>, __greater)
1172 _DEFINE_BINARY_OPERATOR(<=, __less_equal)
1173 _DEFINE_BINARY_OPERATOR(>=, __greater_equal)
1175 #undef _DEFINE_BINARY_OPERATOR
1177 #ifdef __GXX_EXPERIMENTAL_CXX0X__
1217 #endif // __GXX_EXPERIMENTAL_CXX0X__
1221 _GLIBCXX_END_NAMESPACE_VERSION
Reference to one-dimensional subset of an array.
Reference to selected subset of an array.
_UnaryOp< __negate >::_Rt operator-() const
Return a new valarray by applying unary - to each element.
_ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
Return the maximum element in a range using comparison functor.
valarray< _Tp > cshift(int __n) const
Return a rotated array.
void resize(size_t __size, _Tp __c=_Tp())
Resize array.
void swap(valarray< _Tp > &__v) noexcept
Swap.
_Tp & operator[](size_t __i)
Reference to arbitrary subset of an array.
Class defining one-dimensional subset of an array.
valarray< _Tp > & operator^=(const _Tp &)
Set each element e of array to e ^ t.
Smart array designed to support numeric processing.
valarray()
Construct an empty array.
valarray< _Tp > & operator|=(const _Tp &)
Set each element e of array to e | t.
valarray< _Tp > & operator%=(const _Tp &)
Set each element e of array to e % t.
_UnaryOp< __unary_plus >::_Rt operator+() const
Return a new valarray by applying unary + to each element.
valarray< _Tp > & operator<<=(const _Tp &)
Left shift each element e of array by t bits.
_ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
Return the minimum element in a range using comparison functor.
_Tp max() const
Return the maximum element using operator<().
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initilizer_list.
valarray< _Tp > & operator>>=(const _Tp &)
Right shift each element e of array by t bits.
valarray< _Tp > & operator/=(const _Tp &)
Divide each element of array by t.
Reference to multi-dimensional subset of an array.
valarray< _Tp > & operator-=(const _Tp &)
Subtract t to each element of array.
valarray< _Tp > & operator&=(const _Tp &)
Set each element e of array to e & t.
size_t size() const
Return the number of elements in array.
valarray< _Tp > & operator=(const valarray< _Tp > &__v)
Assign elements to an array.
valarray< _Tp > shift(int __n) const
Return a shifted array.
_Tp sum() const
Return the sum of all elements in the array.
_UnaryOp< __bitwise_not >::_Rt operator~() const
Return a new valarray by applying unary ~ to each element.
_Tp min() const
Return the minimum element using operator<().
_Tp * __addressof(_Tp &__r) _GLIBCXX_NOEXCEPT
Same as C++11 std::addressof.
valarray< _Tp > & operator+=(const _Tp &)
Add t to each element of array.
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp func(_Tp)) const
Apply a function to the array.
valarray< _Tp > & operator*=(const _Tp &)
Multiply each element of array by t.
Class defining multi-dimensional subset of an array.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initilizer_list.
_UnaryOp< __logical_not >::_Rt operator!() const
Return a new valarray by applying unary ! to each element.
constexpr size_t size() const _GLIBCXX_NOEXCEPT
Returns the total number of bits.