31 #ifndef _GLIBCXX_VALARRAY
32 #define _GLIBCXX_VALARRAY 1
34 #pragma GCC system_header
40 #if __cplusplus >= 201103L
44 namespace std _GLIBCXX_VISIBILITY(default)
46 _GLIBCXX_BEGIN_NAMESPACE_VERSION
48 template<
class _Clos,
typename _Tp>
51 template<
typename _Tp1,
typename _Tp2>
54 template<
class _Oper,
template<
class,
class>
class _Meta,
class _Dom>
58 template<
class,
class>
class _Meta1,
59 template<
class,
class>
class _Meta2,
60 class _Dom1,
class _Dom2>
63 template<
template<
class,
class>
class _Meta,
class _Dom>
66 template<
template<
class,
class>
class _Meta,
class _Dom>
69 template<
template<
class,
class>
class _Meta,
class _Dom>
72 template<
template<
class,
class>
class _Meta,
class _Dom>
75 template<
template<
class,
class>
class _Meta,
class _Dom>
86 _GLIBCXX_END_NAMESPACE_VERSION
92 namespace std _GLIBCXX_VISIBILITY(default)
94 _GLIBCXX_BEGIN_NAMESPACE_VERSION
121 typedef typename __fun<_Op, _Tp>::result_type __rt;
122 typedef _Expr<_UnClos<_Op, _ValArray, _Tp>, __rt> _Rt;
125 typedef _Tp value_type;
138 valarray(
const _Tp* __restrict__,
size_t);
143 #if __cplusplus >= 201103L
158 valarray(
const indirect_array<_Tp>&);
160 #if __cplusplus >= 201103L
166 valarray(
const _Expr<_Dom, _Tp>& __e);
180 #if __cplusplus >= 201103L
188 valarray<_Tp>&
operator=(valarray<_Tp>&& __v) noexcept;
198 valarray<_Tp>&
operator=(
const _Tp& __t);
208 valarray<_Tp>&
operator=(
const slice_array<_Tp>& __sa);
218 valarray<_Tp>&
operator=(
const gslice_array<_Tp>& __ga);
228 valarray<_Tp>&
operator=(
const mask_array<_Tp>& __ma);
238 valarray<_Tp>&
operator=(
const indirect_array<_Tp>& __ia);
240 #if __cplusplus >= 201103L
252 template<
class _Dom> valarray<_Tp>&
279 _Expr<_SClos<_ValArray, _Tp>, _Tp>
operator[](slice __s)
const;
302 _Expr<_GClos<_ValArray, _Tp>, _Tp>
operator[](
const gslice& __s)
const;
314 gslice_array<_Tp>
operator[](
const gslice& __s);
328 valarray<_Tp>
operator[](
const valarray<bool>& __m)
const;
342 mask_array<_Tp>
operator[](
const valarray<bool>& __m);
355 _Expr<_IClos<_ValArray, _Tp>, _Tp>
356 operator[](
const valarray<size_t>& __i)
const;
370 indirect_array<_Tp>
operator[](
const valarray<size_t>& __i);
374 typename _UnaryOp<__unary_plus>::_Rt
operator+()
const;
377 typename _UnaryOp<__negate>::_Rt
operator-()
const;
380 typename _UnaryOp<__bitwise_not>::_Rt
operator~()
const;
383 typename _UnaryOp<__logical_not>::_Rt
operator!()
const;
417 valarray<_Tp>&
operator*=(
const valarray<_Tp>&);
420 valarray<_Tp>&
operator/=(
const valarray<_Tp>&);
423 valarray<_Tp>&
operator%=(
const valarray<_Tp>&);
426 valarray<_Tp>&
operator+=(
const valarray<_Tp>&);
429 valarray<_Tp>&
operator-=(
const valarray<_Tp>&);
432 valarray<_Tp>&
operator^=(
const valarray<_Tp>&);
435 valarray<_Tp>&
operator|=(
const valarray<_Tp>&);
438 valarray<_Tp>&
operator&=(
const valarray<_Tp>&);
441 valarray<_Tp>& operator<<=(const valarray<_Tp>&);
447 valarray<_Tp>&
operator*=(
const _Expr<_Dom, _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>&);
468 #if __cplusplus >= 201103L
470 void swap(valarray<_Tp>& __v) noexcept;
505 valarray<_Tp>
shift (
int __n)
const;
522 valarray<_Tp>
cshift(
int __n)
const;
534 _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
apply(_Tp func(_Tp))
const;
546 _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
apply(_Tp func(
const _Tp&))
const;
557 void resize(
size_t __size, _Tp __c = _Tp());
561 _Tp* __restrict__ _M_data;
563 friend class _Array<_Tp>;
566 template<
typename _Tp>
570 __glibcxx_requires_subscript(__i);
574 template<
typename _Tp>
578 __glibcxx_requires_subscript(__i);
584 _GLIBCXX_END_NAMESPACE_VERSION
594 namespace std _GLIBCXX_VISIBILITY(default)
596 _GLIBCXX_BEGIN_NAMESPACE_VERSION
603 template<
typename _Tp>
607 template<
typename _Tp>
610 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
611 { std::__valarray_default_construct(_M_data, _M_data + __n); }
613 template<
typename _Tp>
616 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
617 { std::__valarray_fill_construct(_M_data, _M_data + __n, __t); }
619 template<
typename _Tp>
622 : _M_size(__n), _M_data(__valarray_get_storage<_Tp>(__n))
624 _GLIBCXX_DEBUG_ASSERT(__p != 0 || __n == 0);
625 std::__valarray_copy_construct(__p, __p + __n, _M_data);
628 template<
typename _Tp>
631 : _M_size(__v._M_size), _M_data(__valarray_get_storage<_Tp>(__v._M_size))
632 { std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
635 #if __cplusplus >= 201103L
636 template<
typename _Tp>
639 : _M_size(__v._M_size), _M_data(__v._M_data)
646 template<
typename _Tp>
649 : _M_size(__sa._M_sz), _M_data(__valarray_get_storage<_Tp>(__sa._M_sz))
651 std::__valarray_copy_construct
652 (__sa._M_array, __sa._M_sz, __sa._M_stride, _Array<_Tp>(_M_data));
655 template<
typename _Tp>
658 : _M_size(__ga._M_index.
size()),
659 _M_data(__valarray_get_storage<_Tp>(_M_size))
661 std::__valarray_copy_construct
662 (__ga._M_array, _Array<size_t>(__ga._M_index),
663 _Array<_Tp>(_M_data), _M_size);
666 template<
typename _Tp>
669 : _M_size(__ma._M_sz), _M_data(__valarray_get_storage<_Tp>(__ma._M_sz))
671 std::__valarray_copy_construct
672 (__ma._M_array, __ma._M_mask, _Array<_Tp>(_M_data), _M_size);
675 template<
typename _Tp>
678 : _M_size(__ia._M_sz), _M_data(__valarray_get_storage<_Tp>(__ia._M_sz))
680 std::__valarray_copy_construct
681 (__ia._M_array, __ia._M_index, _Array<_Tp>(_M_data), _M_size);
684 #if __cplusplus >= 201103L
685 template<
typename _Tp>
688 : _M_size(__l.
size()), _M_data(__valarray_get_storage<_Tp>(__l.
size()))
689 { std::__valarray_copy_construct(__l.begin(), __l.end(), _M_data); }
692 template<
typename _Tp>
template<
class _Dom>
695 : _M_size(__e.
size()), _M_data(__valarray_get_storage<_Tp>(_M_size))
696 { std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); }
698 template<
typename _Tp>
700 valarray<_Tp>::~valarray() _GLIBCXX_NOEXCEPT
702 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
703 std::__valarray_release_memory(_M_data);
706 template<
typename _Tp>
707 inline valarray<_Tp>&
712 if (_M_size == __v._M_size)
713 std::__valarray_copy(__v._M_data, _M_size, _M_data);
718 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
719 std::__valarray_release_memory(_M_data);
721 _M_size = __v._M_size;
722 _M_data = __valarray_get_storage<_Tp>(_M_size);
723 std::__valarray_copy_construct(__v._M_data, __v._M_data + _M_size,
729 #if __cplusplus >= 201103L
730 template<
typename _Tp>
736 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
737 std::__valarray_release_memory(_M_data);
739 _M_size = __v._M_size;
740 _M_data = __v._M_data;
746 template<
typename _Tp>
752 if (_M_size == __l.size())
753 std::__valarray_copy(__l.begin(), __l.size(), _M_data);
758 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
759 std::__valarray_release_memory(_M_data);
761 _M_size = __l.size();
762 _M_data = __valarray_get_storage<_Tp>(_M_size);
763 std::__valarray_copy_construct(__l.begin(), __l.begin() + _M_size,
770 template<
typename _Tp>
774 std::__valarray_fill(_M_data, _M_size, __t);
778 template<
typename _Tp>
782 _GLIBCXX_DEBUG_ASSERT(_M_size == __sa._M_sz);
783 std::__valarray_copy(__sa._M_array, __sa._M_sz,
784 __sa._M_stride, _Array<_Tp>(_M_data));
788 template<
typename _Tp>
792 _GLIBCXX_DEBUG_ASSERT(_M_size == __ga._M_index.
size());
793 std::__valarray_copy(__ga._M_array, _Array<size_t>(__ga._M_index),
794 _Array<_Tp>(_M_data), _M_size);
798 template<
typename _Tp>
802 _GLIBCXX_DEBUG_ASSERT(_M_size == __ma._M_sz);
803 std::__valarray_copy(__ma._M_array, __ma._M_mask,
804 _Array<_Tp>(_M_data), _M_size);
808 template<
typename _Tp>
812 _GLIBCXX_DEBUG_ASSERT(_M_size == __ia._M_sz);
813 std::__valarray_copy(__ia._M_array, __ia._M_index,
814 _Array<_Tp>(_M_data), _M_size);
818 template<
typename _Tp>
template<
class _Dom>
824 if (_M_size == __e.size())
825 std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data));
830 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
831 std::__valarray_release_memory(_M_data);
833 _M_size = __e.size();
834 _M_data = __valarray_get_storage<_Tp>(_M_size);
835 std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data));
840 template<
typename _Tp>
841 inline _Expr<_SClos<_ValArray,_Tp>, _Tp>
844 typedef _SClos<_ValArray,_Tp> _Closure;
845 return _Expr<_Closure, _Tp>(_Closure (_Array<_Tp>(_M_data), __s));
848 template<
typename _Tp>
853 template<
typename _Tp>
854 inline _Expr<_GClos<_ValArray,_Tp>, _Tp>
857 typedef _GClos<_ValArray,_Tp> _Closure;
858 return _Expr<_Closure, _Tp>
859 (_Closure(_Array<_Tp>(_M_data), __gs._M_index->_M_index));
862 template<
typename _Tp>
867 (_Array<_Tp>(_M_data), __gs._M_index->_M_index);
870 template<
typename _Tp>
875 size_t __e = __m.
size();
876 for (
size_t __i=0; __i<__e; ++__i)
879 _Array<bool> (__m)));
882 template<
typename _Tp>
887 size_t __e = __m.
size();
888 for (
size_t __i=0; __i<__e; ++__i)
893 template<
typename _Tp>
894 inline _Expr<_IClos<_ValArray,_Tp>, _Tp>
897 typedef _IClos<_ValArray,_Tp> _Closure;
898 return _Expr<_Closure, _Tp>(_Closure(*
this, __i));
901 template<
typename _Tp>
906 _Array<size_t>(__i));
909 #if __cplusplus >= 201103L
928 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
929 return std::__valarray_sum(_M_data, _M_data + _M_size);
941 _Tp* __restrict__ __tmp_M_data =
942 std::__valarray_get_storage<_Tp>(_M_size);
945 std::__valarray_copy_construct(_M_data,
946 _M_data + _M_size, __tmp_M_data);
949 if (
size_t(__n) > _M_size)
952 std::__valarray_copy_construct(_M_data + __n,
953 _M_data + _M_size, __tmp_M_data);
954 std::__valarray_default_construct(__tmp_M_data + _M_size - __n,
955 __tmp_M_data + _M_size);
959 if (-
size_t(__n) > _M_size)
962 std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
964 std::__valarray_default_construct(__tmp_M_data,
968 __ret._M_size = _M_size;
969 __ret._M_data = __tmp_M_data;
982 _Tp* __restrict__ __tmp_M_data =
983 std::__valarray_get_storage<_Tp>(_M_size);
986 std::__valarray_copy_construct(_M_data,
987 _M_data + _M_size, __tmp_M_data);
990 if (
size_t(__n) > _M_size)
991 __n = int(__n % _M_size);
993 std::__valarray_copy_construct(_M_data, _M_data + __n,
994 __tmp_M_data + _M_size - __n);
995 std::__valarray_copy_construct(_M_data + __n, _M_data + _M_size,
1000 if (-
size_t(__n) > _M_size)
1001 __n = -int(-
size_t(__n) % _M_size);
1003 std::__valarray_copy_construct(_M_data + _M_size + __n,
1004 _M_data + _M_size, __tmp_M_data);
1005 std::__valarray_copy_construct(_M_data, _M_data + _M_size + __n,
1006 __tmp_M_data - __n);
1009 __ret._M_size = _M_size;
1010 __ret._M_data = __tmp_M_data;
1021 std::__valarray_destroy_elements(_M_data, _M_data + _M_size);
1024 std::__valarray_release_memory(_M_data);
1026 _M_data = __valarray_get_storage<_Tp>(__n);
1028 std::__valarray_fill_construct(_M_data, _M_data + __n, __c);
1031 template<
typename _Tp>
1035 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
1039 template<
typename _Tp>
1043 _GLIBCXX_DEBUG_ASSERT(_M_size > 0);
1048 inline _Expr<_ValFunClos<_ValArray, _Tp>, _Tp>
1051 typedef _ValFunClos<_ValArray, _Tp> _Closure;
1052 return _Expr<_Closure, _Tp>(_Closure(*
this, func));
1056 inline _Expr<_RefFunClos<_ValArray, _Tp>, _Tp>
1059 typedef _RefFunClos<_ValArray, _Tp> _Closure;
1060 return _Expr<_Closure, _Tp>(_Closure(*
this, func));
1063 #define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name) \
1064 template<typename _Tp> \
1065 inline typename valarray<_Tp>::template _UnaryOp<_Name>::_Rt \
1066 valarray<_Tp>::operator _Op() const \
1068 typedef _UnClos<_Name, _ValArray, _Tp> _Closure; \
1069 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1070 return _Expr<_Closure, _Rt>(_Closure(*this)); \
1073 _DEFINE_VALARRAY_UNARY_OPERATOR(+, __unary_plus)
1074 _DEFINE_VALARRAY_UNARY_OPERATOR(-, __negate)
1075 _DEFINE_VALARRAY_UNARY_OPERATOR(~, __bitwise_not)
1076 _DEFINE_VALARRAY_UNARY_OPERATOR (!, __logical_not)
1078 #undef _DEFINE_VALARRAY_UNARY_OPERATOR
1080 #define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name) \
1081 template<class _Tp> \
1082 inline valarray<_Tp>& \
1083 valarray<_Tp>::operator _Op##=(const _Tp &__t) \
1085 _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, __t); \
1089 template<class _Tp> \
1090 inline valarray<_Tp>& \
1091 valarray<_Tp>::operator _Op##=(const valarray<_Tp> &__v) \
1093 _GLIBCXX_DEBUG_ASSERT(_M_size == __v._M_size); \
1094 _Array_augmented_##_Name(_Array<_Tp>(_M_data), _M_size, \
1095 _Array<_Tp>(__v._M_data)); \
1099 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(+, __plus)
1100 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(-, __minus)
1101 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(*, __multiplies)
1102 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(/, __divides)
1103 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(%, __modulus)
1104 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
1105 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
1106 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
1107 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(<<, __shift_left)
1108 _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(>>, __shift_right)
1110 #undef _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT
1112 #define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name) \
1113 template<class _Tp> template<class _Dom> \
1114 inline valarray<_Tp>& \
1115 valarray<_Tp>::operator _Op##=(const _Expr<_Dom, _Tp>& __e) \
1117 _Array_augmented_##_Name(_Array<_Tp>(_M_data), __e, _M_size); \
1121 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(+, __plus)
1122 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(-, __minus)
1123 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(*, __multiplies)
1124 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(/, __divides)
1125 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(%, __modulus)
1126 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(^, __bitwise_xor)
1127 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(&, __bitwise_and)
1128 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(|, __bitwise_or)
1129 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(<<, __shift_left)
1130 _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(>>, __shift_right)
1132 #undef _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT
1135 #define _DEFINE_BINARY_OPERATOR(_Op, _Name) \
1136 template<typename _Tp> \
1137 inline _Expr<_BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp>, \
1138 typename __fun<_Name, _Tp>::result_type> \
1139 operator _Op(const valarray<_Tp>& __v, const valarray<_Tp>& __w) \
1141 _GLIBCXX_DEBUG_ASSERT(__v.size() == __w.size()); \
1142 typedef _BinClos<_Name, _ValArray, _ValArray, _Tp, _Tp> _Closure; \
1143 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1144 return _Expr<_Closure, _Rt>(_Closure(__v, __w)); \
1147 template<typename _Tp> \
1148 inline _Expr<_BinClos<_Name, _ValArray,_Constant, _Tp, _Tp>, \
1149 typename __fun<_Name, _Tp>::result_type> \
1150 operator _Op(const valarray<_Tp>& __v, const _Tp& __t) \
1152 typedef _BinClos<_Name, _ValArray, _Constant, _Tp, _Tp> _Closure; \
1153 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1154 return _Expr<_Closure, _Rt>(_Closure(__v, __t)); \
1157 template<typename _Tp> \
1158 inline _Expr<_BinClos<_Name, _Constant, _ValArray, _Tp, _Tp>, \
1159 typename __fun<_Name, _Tp>::result_type> \
1160 operator _Op(const _Tp& __t, const valarray<_Tp>& __v) \
1162 typedef _BinClos<_Name, _Constant, _ValArray, _Tp, _Tp> _Closure; \
1163 typedef typename __fun<_Name, _Tp>::result_type _Rt; \
1164 return _Expr<_Closure, _Rt>(_Closure(__t, __v)); \
1167 _DEFINE_BINARY_OPERATOR(+, __plus)
1168 _DEFINE_BINARY_OPERATOR(-, __minus)
1169 _DEFINE_BINARY_OPERATOR(*, __multiplies)
1170 _DEFINE_BINARY_OPERATOR(/, __divides)
1171 _DEFINE_BINARY_OPERATOR(%, __modulus)
1172 _DEFINE_BINARY_OPERATOR(^, __bitwise_xor)
1173 _DEFINE_BINARY_OPERATOR(&, __bitwise_and)
1174 _DEFINE_BINARY_OPERATOR(|, __bitwise_or)
1175 _DEFINE_BINARY_OPERATOR(<<, __shift_left)
1176 _DEFINE_BINARY_OPERATOR(>>, __shift_right)
1177 _DEFINE_BINARY_OPERATOR(&&, __logical_and)
1178 _DEFINE_BINARY_OPERATOR(||, __logical_or)
1179 _DEFINE_BINARY_OPERATOR(==, __equal_to)
1180 _DEFINE_BINARY_OPERATOR(!=, __not_equal_to)
1181 _DEFINE_BINARY_OPERATOR(<, __less)
1182 _DEFINE_BINARY_OPERATOR(>, __greater)
1183 _DEFINE_BINARY_OPERATOR(<=, __less_equal)
1184 _DEFINE_BINARY_OPERATOR(>=, __greater_equal)
1186 #undef _DEFINE_BINARY_OPERATOR
1188 #if __cplusplus >= 201103L
1232 _GLIBCXX_END_NAMESPACE_VERSION
_UnaryOp< __negate >::_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.
_UnaryOp< __unary_plus >::_Rt operator+() const
Return a new valarray by applying unary + to each element.
Reference to selected subset of an array.
Reference to multi-dimensional subset of an array.
_UnaryOp< __logical_not >::_Rt operator!() const
Return a new valarray by applying unary ! to each element.
_Tp sum() const
Return the sum of all elements in the array.
Reference to arbitrary subset of an array.
constexpr const _Tp * begin(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to the first element of the initializer_list.
valarray< _Tp > shift(int __n) const
Return a shifted array.
valarray< _Tp > & operator=(const valarray< _Tp > &__v)
Assign elements to an array.
void resize(size_t __size, _Tp __c=_Tp())
Resize array.
valarray< _Tp > & operator+=(const _Tp &)
Add t to each element of array.
Smart array designed to support numeric processing.
constexpr size_t size() const noexcept
Returns the total number of bits.
_Tp max() const
Return the maximum element using operator<().
_UnaryOp< __bitwise_not >::_Rt operator~() const
Return a new valarray by applying unary ~ to each element.
valarray< _Tp > cshift(int __n) const
Return a rotated array.
Class defining multi-dimensional subset of an array.
void swap(valarray< _Tp > &__v) noexcept
Swap.
size_t size() const
Return the number of elements in array.
_ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
Return the maximum element in a range using comparison functor.
valarray< _Tp > & operator/=(const _Tp &)
Divide each element of array by t.
Reference to one-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.
valarray< _Tp > & operator%=(const _Tp &)
Set each element e of array to e % t.
valarray< _Tp > & operator*=(const _Tp &)
Multiply each element of array by t.
valarray< _Tp > & operator^=(const _Tp &)
Set each element e of array to e ^ t.
valarray< _Tp > & operator>>=(const _Tp &)
Right shift each element e of array by t bits.
valarray()
Construct an empty array.
constexpr const _Tp * end(initializer_list< _Tp > __ils) noexcept
Return an iterator pointing to one past the last element of the initializer_list. ...
void swap(function< _Res(_Args...)> &__x, function< _Res(_Args...)> &__y)
Swap the targets of two polymorphic function object wrappers.
_Tp * __addressof(_Tp &__r) noexcept
Same as C++11 std::addressof.
_Tp min() const
Return the minimum element using operator<().
_Tp & operator[](size_t __i)
Class defining one-dimensional subset of an array.
_ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp)
Return the minimum element in a range using comparison functor.
valarray< _Tp > & operator&=(const _Tp &)
Set each element e of array to e & t.
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp func(_Tp)) const
Apply a function to the array.