NUMERIC_ARRAYS(3)
β¨ NAME β¨
Numeric Arrays β ok so this is the <numeric arrays> corner of the C++ standard library, bestie, and it's all about the number-crunching array family π
You're reading the Numeric Arrays(3) page from the Library Functions Manual, and honestly? It's giving "the whole valarray cinematic universe." Let me walk you through it π«Ά
πΈ Classes πΈ
These are the actual types, and yes, every single one is inside std::, no cap:
class std::gsliceβ class defining a multi-dimensional subset of an array. Like a slice but with dimensions, main character energy π₯class std::gslice_array< _Tp >β a reference to a multi-dimensional subset of an array. It doesn't own anything, it's just pointing at the vibe β¨class std::indirect_array< _Tp >β a reference to an arbitrary subset of an array. Arbitrary?? iconic, she does what she wants πclass std::mask_array< _Tp >β a reference to a selected subset of an array. Selection based, curated, lowkey editorial πclass std::sliceβ class defining a one-dimensional subset of an array. Simple, classic, she ate πclass std::slice_array< _Tp >β a reference to a one-dimensional subset of an array. Slice's little reference buddy π¦class std::valarray< _Tp >β the big one π a smart array designed to support numeric processing. That's her whole purpose, that's her lore
π Defines π
These are the internal macro names, and I'm gonna give them to you exactly as they appear on the page, character for character, because that's the rule and I respect the rule π―
#define _DEFINE_BINARY_OPERATOR(_Op, _Name)
#define _DEFINE_VALARRAY_AUGMENTED_ASSIGNMENT(_Op, _Name)
#define _DEFINE_VALARRAY_EXPR_AUGMENTED_ASSIGNMENT(_Op, _Name)
#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)
#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)
#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)
#define _DEFINE_VALARRAY_OPERATOR(_Op, _Name)
#define _DEFINE_VALARRAY_UNARY_OPERATOR(_Op, _Name)
and yeah β _DEFINE_VALARRAY_OPERATOR(_Op, _Name)</p> is listed four times in a row π not a typo on my end, that's literally what the page says, so I'm keeping all four, periodt. We don't erase history here π
Every one of these takes two parameters, _Op and _Name, and every one of them is an underscore-prefixed internal-looking macro β so unless you're deep in the implementation, these are very much iykyk territory π§
heads up bestie: these #defines have no description text on the page at all, so I'm not about to invent one for them β I'm just showing you they exist, exactly as written πΈ
okay that's the roster, more coming in the next parts β stay with me π¦π
β¨ Functions β¨
okay bestie, this is the big one β every single signature in the list, not a crumb skipped. grab a snack π, we're going in order.
the apply() girlies πΈ
_Expr< _RefFunClos< _ValArray, _Tp >, _Tp > std::valarray::apply (_Tp func(const _Tp &)) constβ takes a function that gets each element byconstreference, and hands back one of those_Exprsituations._Expr< _ValFunClos< _ValArray, _Tp >, _Tp > std::valarray::apply (_Tp func(_Tp)) constβ same energy, but the function takes_Tpby value this time. both areconstmembers, both return_Expr, neither returns a plainvalarray. iykyk π
shifting & slicing royalty π
valarray< _Tp > std::valarray::cshift (int) constβ circular shift, takes anint,constmember, returns a freshvalarray< _Tp >. slay.
constructors doing constructor things π
std::gslice::gslice (const gslice &)β the copy constructor. classic.std::gslice::gslice (size_t, const valarray< size_t > &, const valarray< size_t > &)β the big three-arg one: asize_tplus twovalarray< size_t >references. main character energy fr.std::gslice::gslice ()β the no-arg default one, living her simple life.std::gslice_array::gslice_array (const gslice_array &)β copy constructor, doing exactly what it says.std::indirect_array::indirect_array (const indirect_array &)β same deal, indirect flavour.std::mask_array::mask_array (const mask_array &)β and the masked one. all three copy constructors, all accounted for π«Ά
maxing & minning π
_Tp std::valarray::max () constβconstmember, gives you back a_Tp. the biggest vibe._Tp std::valarray::min () constβconstmember, gives you back a_Tp. the smallest vibe.
the ! moment β
_UnaryOp< __logical_not >::_Rt std::valarray::operator! () constβ unary!,constmember, returns that_UnaryOp< __logical_not >::_Rttype. not me getting excited over a logical not π
operator!= β the not-equal trio π
three flavours, because of course there are three:
template<typename _Tp > _Expr< _BinClos< __not_equal_to, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __not_equal_to, _Tp >::result_type > std::operator!= (const _Tp &__t, const valarray< _Tp > &__v)β_Constanton the left,_ValArrayon the right.template<typename _Tp > _Expr< _BinClos< __not_equal_to, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __not_equal_to, _Tp >::result_type > std::operator!= (const valarray< _Tp > &__v, const _Tp &__t)β flipped:_ValArraythen_Constant.template<typename _Tp > _Expr< _BinClos< __not_equal_to, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __not_equal_to, _Tp >::result_type > std::operator!= (const valarray< _Tp > &__v, const valarray< _Tp > &__w)β the double-valarray icon that it is.
operator% β modulus, three ways π«
template<typename _Tp > _Expr< _BinClos< __modulus, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __modulus, _Tp >::result_type > std::operator% (const _Tp &__t, const valarray< _Tp > &__v)β_Constant,_ValArray.template<typename _Tp > _Expr< _BinClos< __modulus, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __modulus, _Tp >::result_type > std::operator% (const valarray< _Tp > &__v, const _Tp &__t)β_ValArray,_Constant.template<typename _Tp > _Expr< _BinClos< __modulus, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __modulus, _Tp >::result_type > std::operator% (const valarray< _Tp > &__v, const valarray< _Tp > &__w)β_ValArray,_ValArray. the full set, zero notes π
operator%= β the eleven-course meal π½οΈ
bestie this one shows up eleven times, so let's go:
template<class _Dom > void std::slice_array::operator%= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator%= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator%= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator%= (const valarray< _Tp > &) consttemplate<class _Dom > void std::indirect_array::operator%= (const _Expr< _Dom, _Tp > &) constvoid std::indirect_array::operator%= (const valarray< _Tp > &) consttemplate<class _Dom > void std::gslice_array::operator%= (const _Expr< _Dom, _Tp > &) constvoid std::gslice_array::operator%= (const valarray< _Tp > &) consttemplate<class _Dom > valarray< _Tp > & std::valarray::operator%= (const _Expr< _Dom, _Tp > &)valarray< _Tp > & std::valarray::operator%= (const valarray< _Tp > &)valarray< _Tp > & std::valarray::operator%= (const _Tp &)
notice the little glow-up: the four helper-array versions are void and const members, while the three valarray ones return valarray< _Tp > & and are not const. periodt.
operator& β bitwise besties π¦
template<typename _Tp > _Expr< _BinClos< __bitwise_and, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __bitwise_and, _Tp >::result_type > std::operator& (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __bitwise_and, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __bitwise_and, _Tp >::result_type > std::operator& (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __bitwise_and, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __bitwise_and, _Tp >::result_type > std::operator& (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
constant-valarray, valarray-constant, valarray-valarray. the holy trinity lowkey π₯
operator&& β the logical and trio π§
template<typename _Tp > _Expr< _BinClos< __logical_and, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __logical_and, _Tp >::result_type > std::operator&& (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __logical_and, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __logical_and, _Tp >::result_type > std::operator&& (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __logical_and, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __logical_and, _Tp >::result_type > std::operator&& (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
same three-flavour pattern, logical edition. we love consistency π
operator&= β yup, eleven again π
template<class _Dom > void std::slice_array::operator&= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator&= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator&= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator&= (const valarray< _Tp > &) consttemplate<class _Dom > void std::indirect_array::operator&= (const _Expr< _Dom, _Tp > &) constvoid std::indirect_array::operator&= (const valarray< _Tp > &) consttemplate<class _Dom > void std::gslice_array::operator&= (const _Expr< _Dom, _Tp > &) constvoid std::gslice_array::operator&= (const valarray< _Tp > &) consttemplate<class _Dom > valarray< _Tp > & std::valarray::operator&= (const _Expr< _Dom, _Tp > &)valarray< _Tp > & std::valarray::operator&= (const valarray< _Tp > &)valarray< _Tp > & std::valarray::operator&= (const _Tp &)
same void x const situation on the helpers, same valarray< _Tp > & on the valarray ones. no cap. π
operator* β multiply era π
template<typename _Tp > _Expr< _BinClos< __multiplies, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __multiplies, _Tp >::result_type > std::operator* (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __multiplies, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __multiplies, _Tp >::result_type > std::operator* (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __multiplies, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __multiplies, _Tp >::result_type > std::operator* (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
the __multiplies clique, all three present and accounted for π«Ά
operator*= β the eleven, take three π
template<class _Dom > void std::slice_array::operator*= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator*= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator*= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator*= (const valarray< _Tp > &) consttemplate<class _Dom > void std::indirect_array::operator*= (const _Expr< _Dom, _Tp > &) constvoid std::indirect_array::operator*= (const valarray< _Tp > &) consttemplate<class _Dom > void std::gslice_array::operator*= (const _Expr< _Dom, _Tp > &) constvoid std::gslice_array::operator*= (const valarray< _Tp > &) consttemplate<class _Dom > valarray< _Tp > & std::valarray::operator*= (const _Expr< _Dom, _Tp > &)valarray< _Tp > & std::valarray::operator*= (const valarray< _Tp > &)valarray< _Tp > & std::valarray::operator*= (const _Tp &)
yes bestie, same eleven. it's giving commitment to the bit β¨
operator+, unary edition βοΈ
_UnaryOp< __unary_plus >::_Rt std::valarray::operator+ () constβ unary plus,constmember, returns_UnaryOp< __unary_plus >::_Rt. a whole mood.
operator+, the binary trio πΌ
template<typename _Tp > _Expr< _BinClos< __plus, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __plus, _Tp >::result_type > std::operator+ (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __plus, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __plus, _Tp >::result_type > std::operator+ (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __plus, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __plus, _Tp >::result_type > std::operator+ (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
__plus three ways, as the universe intended π
operator+= β eleven course meal, part four π°
template<class _Dom > void std::slice_array::operator+= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator+= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator+= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator+= (const valarray< _Tp > &) consttemplate<class _Dom > void std::indirect_array::operator+= (const _Expr< _Dom, _Tp > &) constvoid std::indirect_array::operator+= (const valarray< _Tp > &) consttemplate<class _Dom > void std::gslice_array::operator+= (const _Expr< _Dom, _Tp > &) constvoid std::gslice_array::operator+= (const valarray< _Tp > &) consttemplate<class _Dom > valarray< _Tp > & std::valarray::operator+= (const _Expr< _Dom, _Tp > &)valarray< _Tp > & std::valarray::operator+= (const valarray< _Tp > &)valarray< _Tp > & std::valarray::operator+= (const _Tp &)
still iconic, still eleven, still the same return-type pattern π
operator-, unary edition π
_UnaryOp< __negate >::_Rt std::valarray::operator- () constβ unary minus!__negate!const! returns_UnaryOp< __negate >::_Rt. she's the moment.
operator-, the binary trio π§
template<typename _Tp > _Expr< _BinClos< __minus, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __minus, _Tp >::result_type > std::operator- (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __minus, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __minus, _Tp >::result_type > std::operator- (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __minus, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __minus, _Tp >::result_type > std::operator- (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
constant-valarray, valarray-constant, valarray-valarray. __minus ate and left no crumbs π₯
operator-= β bestie it's eleven again π
template<class _Dom > void std::slice_array::operator-= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator-= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator-= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator-= (const valarray< _Tp > &) consttemplate<class _Dom > void std::indirect_array::operator-= (const _Expr< _Dom, _Tp > &) constvoid std::indirect_array::operator-= (const valarray< _Tp > &) consttemplate<class _Dom > void std::gslice_array::operator-= (const _Expr< _Dom, _Tp > &) constvoid std::gslice_array::operator-= (const valarray< _Tp > &) consttemplate<class _Dom > valarray< _Tp > & std::valarray::operator-= (const _Expr< _Dom, _Tp > &)valarray< _Tp > & std::valarray::operator-= (const valarray< _Tp > &)valarray< _Tp > & std::valarray::operator-= (const _Tp &)
all the subtract-assign besties in one place, you're welcome π«Ά
operator/ β divide era π¦
template<typename _Tp > _Expr< _BinClos< __divides, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __divides, _Tp >::result_type > std::operator/ (const _Tp &__t, const valarray< _Tp > &__v)template<typename _Tp > _Expr< _BinClos< __divides, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __divides, _Tp >::result_type > std::operator/ (const valarray< _Tp > &__v, const _Tp &__t)template<typename _Tp > _Expr< _BinClos< __divides, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __divides, _Tp >::result_type > std::operator/ (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
__divides showing up with the full three-part serve β
operator/= β starting the run π«
template<class _Dom > void std::slice_array::operator/= (const _Expr< _Dom, _Tp > &) constvoid std::slice_array::operator/= (const valarray< _Tp > &) consttemplate<class _Dom > void std::mask_array::operator/= (const _Expr< _Dom, _Tp > &) constvoid std::mask_array::operator/= (const valarray< _Tp > &) const
okay bestie we are STILL in the synopsis trenches and the operator list is lowkey iconic β it's giving "every assignment operator ever invented" π every single signature is here, character for character, so don't skip a line, iykyk.
the /= era, aka divide-and-conquer energy π
indirect_array and gslice_array both do the /= thing, and then valarray itself shows up with three whole flavors:
template<class _Dom > void std::indirect_array::operator/= (const _Expr< _Dom, _Tp > &) const
void std::indirect_array::operator/= (const valarray< _Tp > &) const
template<class _Dom > void std::gslice_array::operator/= (const _Expr< _Dom, _Tp > &) const
void std::gslice_array::operator/= (const valarray< _Tp > &) const
template<class _Dom > valarray< _Tp > & std::valarray::operator/= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator/= (const valarray< _Tp > &)
valarray< _Tp > & std::valarray::operator/= (const _Tp &)
notice how the array-ish helpers return void but the actual valarray returns valarray< _Tp > &? that's your little tell, bestie π
less-than, the og comparison < πΈ
three overloads, because of course there are three β constant-vs-valarray, valarray-vs-constant, and valarray-vs-valarray:
template<typename _Tp > _Expr< _BinClos< __less, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __less, _Tp >::result_type > std::operator< (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __less, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __less, _Tp >::result_type > std::operator< (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __less, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __less, _Tp >::result_type > std::operator< (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
the way __less just keeps showing up in every single one π that's the whole motif, fr fr.
left shift << and where it goes π
first the free operators β __shift_left, same three-way pattern:
template<typename _Tp > _Expr< _BinClos< __shift_left, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __shift_left, _Tp >::result_type > std::operator<< (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __shift_left, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __shift_left, _Tp >::result_type > std::operator<< (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __shift_left, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __shift_left, _Tp >::result_type > std::operator<< (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
then the compound <<= β and babes, every array-view class gets a turn plus the main valarray:
template<class _Dom > void std::slice_array::operator<<= (const _Expr< _Dom, _Tp > &) const
void std::slice_array::operator<<= (const valarray< _Tp > &) const
template<class _Dom > void std::mask_array::operator<<= (const _Expr< _Dom, _Tp > &) const
void std::mask_array::operator<<= (const valarray< _Tp > &) const
template<class _Dom > void std::indirect_array::operator<<= (const _Expr< _Dom, _Tp > &) const
void std::indirect_array::operator<<= (const valarray< _Tp > &) const
template<class _Dom > void std::gslice_array::operator<<= (const _Expr< _Dom, _Tp > &) const
void std::gslice_array::operator<<= (const valarray< _Tp > &) const
template<class _Dom > valarray< _Tp > & std::valarray::operator<<= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator<<= (const valarray< _Tp > &)
valarray< _Tp > & std::valarray::operator<<= (const _Tp &)
slice_array β mask_array β indirect_array β gslice_array β valarray, in that exact order. the consistency? we love to see it β¨
less-than-or-equal <= π
same three-way trio, just with __less_equal:
template<typename _Tp > _Expr< _BinClos< __less_equal, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __less_equal, _Tp >::result_type > std::operator<= (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __less_equal, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __less_equal, _Tp >::result_type > std::operator<= (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __less_equal, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __less_equal, _Tp >::result_type > std::operator<= (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
the big one: operator= ππ
okay this is the main character of the section, and it is LONG. buckle up.
slice_array β four whole overloads, including the _Tp one and the self-assign:
template<class _Dom > void std::slice_array::operator= (const _Expr< _Dom, _Tp > &) const
void std::slice_array::operator= (const valarray< _Tp > &) const
void std::slice_array::operator= (const _Tp &) const
slice_array & std::slice_array::operator= (const slice_array &)
mask_array β same deal, but its template param is named _Ex and the arg is __e, not _Dom. don't you dare "fix" that π:
template<class _Ex > void std::mask_array::operator= (const _Expr< _Ex, _Tp > &__e) const
void std::mask_array::operator= (const valarray< _Tp > &) const
void std::mask_array::operator= (const _Tp &) const
mask_array & std::mask_array::operator= (const mask_array &)
indirect_array β four, and yes it returns indirect_array &:
template<class _Dom > void std::indirect_array::operator= (const _Expr< _Dom, _Tp > &) const
void std::indirect_array::operator= (const valarray< _Tp > &) const
void std::indirect_array::operator= (const _Tp &) const
indirect_array & std::indirect_array::operator= (const indirect_array &)
gslice_array β four more:
template<class _Dom > void std::gslice_array::operator= (const _Expr< _Dom, _Tp > &) const
void std::gslice_array::operator= (const valarray< _Tp > &) const
void std::gslice_array::operator= (const _Tp &) const
gslice_array & std::gslice_array::operator= (const gslice_array &)
gslice itself, being all simple and self-assigning:
gslice & std::gslice::operator= (const gslice &)
and finally the queen, valarray::operator= β eight overloads, and the initializer_list one returns just valarray & while the rest return valarray< _Tp > &. yes, we clocked that. yes, it matters. periodt:
template<class _Dom > valarray< _Tp > & std::valarray::operator= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator= (const indirect_array< _Tp > &)
valarray< _Tp > & std::valarray::operator= (const mask_array< _Tp > &)
valarray< _Tp > & std::valarray::operator= (const gslice_array< _Tp > &)
valarray< _Tp > & std::valarray::operator= (const slice_array< _Tp > &)
valarray< _Tp > & std::valarray::operator= (const _Tp &)
valarray & std::valarray::operator= (initializer_list< _Tp >)
valarray< _Tp > & std::valarray::operator= (const valarray< _Tp > &)
lowkey obsessed thatindirect_array,mask_array,gslice_arrayandslice_arrayall get their own assign-from-view overload up in here. it's giving "everybody gets a seat at the table" π«Ά
equality == π¦
the classic three-way, __equal_to edition:
template<typename _Tp > _Expr< _BinClos< __equal_to, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __equal_to, _Tp >::result_type > std::operator== (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __equal_to, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __equal_to, _Tp >::result_type > std::operator== (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __equal_to, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __equal_to, _Tp >::result_type > std::operator== (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
greater-than > π₯ and greater-or-equal >= β
shockingly (not shockingly) it's the same trio twice, once with __greater and once with __greater_equal:
template<typename _Tp > _Expr< _BinClos< __greater, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __greater, _Tp >::result_type > std::operator> (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __greater, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __greater, _Tp >::result_type > std::operator> (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __greater, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __greater, _Tp >::result_type > std::operator> (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
template<typename _Tp > _Expr< _BinClos< __greater_equal, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __greater_equal, _Tp >::result_type > std::operator>= (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __greater_equal, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __greater_equal, _Tp >::result_type > std::operator>= (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __greater_equal, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __greater_equal, _Tp >::result_type > std::operator>= (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
right shift >> and >>= π
right shift gets the same three free operators, now with __shift_right:
template<typename _Tp > _Expr< _BinClos< __shift_right, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __shift_right, _Tp >::result_type > std::operator>> (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __shift_right, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __shift_right, _Tp >::result_type > std::operator>> (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __shift_right, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __shift_right, _Tp >::result_type > std::operator>> (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
and the compound >>=, which is literally the <<= block with the arrow flipped β same five classes, same void-vs-valarray< _Tp > & split:
template<class _Dom > void std::slice_array::operator>>= (const _Expr< _Dom, _Tp > &) const
void std::slice_array::operator>>= (const valarray< _Tp > &) const
template<class _Dom > void std::mask_array::operator>>= (const _Expr< _Dom, _Tp > &) const
void std::mask_array::operator>>= (const valarray< _Tp > &) const
template<class _Dom > void std::indirect_array::operator>>= (const _Expr< _Dom, _Tp > &) const
void std::indirect_array::operator>>= (const valarray< _Tp > &) const
template<class _Dom > void std::gslice_array::operator>>= (const _Expr< _Dom, _Tp > &) const
void std::gslice_array::operator>>= (const valarray< _Tp > &) const
template<class _Dom > valarray< _Tp > & std::valarray::operator>>= (const _Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator>>= (const valarray< _Tp > &)
valarray< _Tp > & std::valarray::operator>>= (const _Tp &)
the way >> and >>= just mirrored the entire previous sectionβ¦ consistent queen behavior π
operator[], aka the whole reason the other classes exist ππ
okay this is THE subsection β every way you can index a valarray. look at all these return types, they're literally the star cast of the page:
indirect_array< _Tp > std::valarray::operator[] (const valarray< size_t > &)
_Expr< _IClos< _ValArray, _Tp >, _Tp > std::valarray::operator[] (const valarray< size_t > &) const
mask_array< _Tp > std::valarray::operator[] (const valarray< bool > &)
valarray< _Tp > std::valarray::operator[] (const valarray< bool > &) const
gslice_array< _Tp > std::valarray::operator[] (const gslice &)
_Expr< _GClos< _ValArray, _Tp >, _Tp > std::valarray::operator[] (const gslice &) const
slice_array< _Tp > std::valarray::operator[] (slice)
_Expr< _SClos< _ValArray, _Tp >, _Tp > std::valarray::operator[] (slice) const
_Tp & std::valarray::operator[] (size_t)
const _Tp & std::valarray::operator[] (size_t) const
so: valarray< size_t > β indirect_array (_IClos on the const side), valarray< bool > β mask_array (but plain valarray< _Tp > when const, yes really, look again), gslice β gslice_array (_GClos when const), slice β slice_array (_SClos when const), and plain old size_t β a _Tp & (or const _Tp & for the const one). π
bitwise xor ^ and ^= π§
the trio, with __bitwise_xor:
template<typename _Tp > _Expr< _BinClos< __bitwise_xor, _Constant, _ValArray, _Tp, _Tp >, typename __fun< __bitwise_xor, _Tp >::result_type > std::operator^ (const _Tp &__t, const valarray< _Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __bitwise_xor, _ValArray, _Constant, _Tp, _Tp >, typename __fun< __bitwise_xor, _Tp >::result_type > std::operator^ (const valarray< _Tp > &__v, const _Tp &__t)
template<typename _Tp > _Expr< _BinClos< __bitwise_xor, _ValArray, _ValArray, _Tp, _Tp >, typename __fun< __bitwise_xor, _Tp >::result_type > std::operator^ (const valarray< _Tp > &__v, const valarray< _Tp > &__w)
and the compound ^= across the four view classes:
template<class _Dom > void std::slice_array::operator^= (const _Expr< _Dom, _Tp > &) const
void std::slice_array::operator^= (const valarray< _Tp > &) const
template<class _Dom > void std::mask_array::operator^= (const _Expr< _Dom, _Tp > &) const
void std::mask_array::operator^= (const valarray< _Tp > &) const
template<class _Dom > void std::indirect_array::operator^= (const _Expr< _Dom, _Tp > &) const
void std::indirect_array::operator^= (const valarray< _Tp > &) const
template<class _Dom > void std::gslice_array::operator^= (const _Expr< _Dom, _Tp > &) const
void std::gslice_array::operator^= (const valarray< _Tp > &) const
every single one returns void and takes const, no cap. and that's exactly where this chunk leaves us, bestie β¨ π¦
template<class _Dom > valarray< _Tp > & std::valarray::operator^= (const
_Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator^= (const valarray< _Tp > &)
valarray< _Tp > & std::valarray::operator^= (const _Tp &)
template<typename _Tp > _Expr< _BinClos< __bitwise_or, _Constant,
_ValArray, _Tp, _Tp >, typename __fun< __bitwise_or, _Tp
>::result_type > std::operator| (const _Tp &__t, const valarray< _Tp
> &__v)
template<typename _Tp > _Expr< _BinClos< __bitwise_or, _ValArray,
_Constant, _Tp, _Tp >, typename __fun< __bitwise_or, _Tp
>::result_type > std::operator| (const valarray< _Tp > &__v, const
_Tp &__t)
template<typename _Tp > _Expr< _BinClos< __bitwise_or, _ValArray,
_ValArray, _Tp, _Tp >, typename __fun< __bitwise_or, _Tp
>::result_type > std::operator| (const valarray< _Tp > &__v, const
valarray< _Tp > &__w)
template<class _Dom > void std::slice_array::operator|= (const _Expr<
_Dom, _Tp > &) const
void std::slice_array::operator|= (const valarray< _Tp > &) const
template<class _Dom > void std::mask_array::operator|= (const _Expr<
_Dom, _Tp > &) const
void std::mask_array::operator|= (const valarray< _Tp > &) const
template<class _Dom > void std::indirect_array::operator|= (const _Expr<
_Dom, _Tp > &) const
void std::indirect_array::operator|= (const valarray< _Tp > &) const
template<class _Dom > void std::gslice_array::operator|= (const _Expr<
_Dom, _Tp > &) const
void std::gslice_array::operator|= (const valarray< _Tp > &) const
template<class _Dom > valarray< _Tp > & std::valarray::operator|= (const
_Expr< _Dom, _Tp > &)
valarray< _Tp > & std::valarray::operator|= (const valarray< _Tp > &)
valarray< _Tp > & std::valarray::operator|= (const _Tp &)
template<typename _Tp > _Expr< _BinClos< __logical_or, _Constant,
_ValArray, _Tp, _Tp >, typename __fun< __logical_or, _Tp
>::result_type > std::operator|| (const _Tp &__t, const valarray<
_Tp > &__v)
template<typename _Tp > _Expr< _BinClos< __logical_or, _ValArray,
_Constant, _Tp, _Tp >, typename __fun< __logical_or, _Tp
>::result_type > std::operator|| (const valarray< _Tp > &__v, const
_Tp &__t)
template<typename _Tp > _Expr< _BinClos< __logical_or, _ValArray,
_ValArray, _Tp, _Tp >, typename __fun< __logical_or, _Tp
>::result_type > std::operator|| (const valarray< _Tp > &__v, const
valarray< _Tp > &__w)
_UnaryOp< __bitwise_not >::_Rt std::valarray::operator~ () const
void std::valarray::resize (size_t __size, _Tp __c=_Tp())
valarray< _Tp > std::valarray::shift (int) const
size_t std::slice::size () const
valarray< size_t > std::gslice::size () const
size_t std::valarray::size () const
std::slice::slice (size_t, size_t, size_t)
std::slice::slice ()
std::slice_array::slice_array (const slice_array &)
size_t std::slice::start () const
size_t std::gslice::start () const
size_t std::slice::stride () const
valarray< size_t > std::gslice::stride () const
_Tp std::valarray::sum () const
template<class _Dom > std::valarray::valarray (const _Expr< _Dom, _Tp >
&__e)
std::valarray::valarray (initializer_list< _Tp >)
std::valarray::valarray (const indirect_array< _Tp > &)
std::valarray::valarray (const mask_array< _Tp > &)
std::valarray::valarray (const gslice_array< _Tp > &)
std::valarray::valarray (const slice_array< _Tp > &)
std::valarray::valarray (const valarray &)
template<typename _Tp> std::valarray::valarray (const _Tp *__restrict__
__p, size_t __n)
std::valarray::valarray (const _Tp &, size_t)
std::valarray::valarray (size_t)
std::valarray::valarray ()
std::gslice::~gslice ()
π Detailed Description π
Classes and functions for representing and manipulating arrays of elements. That's the whole vibe, bestie β collections of stuff, and a whole little ecosystem of helpers to poke at them. β¨
πΈ Function Documentation πΈ
π«Ά apply β the "do a thing to everything" queen
template<class _Tp> _Expr< _RefFunClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::apply (_Tp funcconst _Tp &) const [inline, inherited]
Apply a function to the array. π
Returns a new valarray where every element got assigned the result of applying func to the corresponding element of this array. The new array has the same size as this one β no glow-ups, no shrinkage, same size periodt.
- Parameters:
funcβ Function of const Tp& returning Tp to apply.
- Returns: New valarray with transformed elements.
Definition at line 951 of file valarray.
template<class _Tp> _Expr< _ValFunClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::apply (_Tp func_Tp) const [inline, inherited]
Apply a function to the array. Same energy, different overload, we love a versatile icon π
Returns a new valarray with elements assigned to the result of applying func to the corresponding element of this array. The new array has the same size as this one.
- Parameters:
funcβ Function of Tp returning Tp to apply.
- Returns: New valarray with transformed elements.
Definition at line 943 of file valarray.
π cshift β the rotation station
template<class _Tp > valarray< _Tp > std::valarray< _Tp >::cshift (int __n) const [inline, inherited]
Return a rotated array. Literally the carousel emoji of container methods π
A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is (i - n) % size(). The new valarray has the same size as the current one. Elements that are shifted beyond the array bounds are shifted into the other end of the array. No elements are lost. (say it louder for the people in the back, nothing gets yeeted π
)
Positive arguments shift toward index 0, wrapping around the top. Negative arguments shift towards the top, wrapping around to 0.
- Parameters:
nβ Number of element positions to rotate.
- Returns: New valarray with elements in shifted positions.
Definition at line 869 of file valarray.
References std::valarray< _Tp >::_M_data, and std::valarray< _Tp >::_M_size.
π§ gslice, my beloved
std::gslice::gslice (const gslice & __g) [inline, inherited]
Copy constructor. Short, sweet, iconic.
Definition at line 156 of file gslice.h.
std::gslice::gslice (size_t __o, const valarray< size_t > & __l, const valarray< size_t > & __s) [inline, inherited]
Construct a slice. π
Constructs a slice with as many dimensions as the length of the l and s arrays.
- Parameters:
oβ Offset in array of first element.lβ Array of dimension lengths.sβ Array of dimension strides between array elements.
Definition at line 151 of file gslice.h.
std::gslice::gslice () [inline, inherited]
Construct an empty slice. The "no thoughts, head empty" constructor π«§
Definition at line 147 of file gslice.h.
π« slay_array copy constructors (all of them, we're thorough)
template<typename _Tp > std::gslice_array< _Tp >::gslice_array (const gslice_array< _Tp > & __a) [inline, inherited]
Copy constructor. Both slices refer to the same underlying array. π (yes, they're holding hands, same data)
Definition at line 142 of file gslice_array.h.
template<typename _Tp > std::indirect_array< _Tp >::indirect_array (const indirect_array< _Tp > & __a) [inline, inherited]
Copy constructor. Both slices refer to the same underlying array. Same deal, same shared-data situation πͺ
Definition at line 142 of file indirect_array.h.
template<typename _Tp > std::mask_array< _Tp >::mask_array (const mask_array< _Tp > & a) [inline, inherited]
Copy constructor. Both slices refer to the same underlying array. Third time's the charm, still sharing π
Definition at line 138 of file mask_array.h.
π max & min
template<typename _Tp > _Tp std::valarray< _Tp >::max () const [inline, inherited]
Return the maximum element using operator<(). The main character of your array, found and crowned π₯
Definition at line 935 of file valarray.
References std::max_element().
template<typename _Tp > _Tp std::valarray< _Tp >::min () const [inline, inherited]
Return the minimum element using operator<(). The humble fave, smallest but still valid π
Definition at line 927 of file valarray.
References std::min_element().
π the unary !
template<typename _Tp > valarray< _Tp >::template _UnaryOp< __logical_not >::_Rt std::valarray< _Tp >::operator! () const [inline, inherited]
Return a new valarray by applying unary ! to each element. Not me flipping literally every single one of them π
Definition at line 970 of file valarray.
π
operator%= β modulo era
template<typename _Tp > void std::slice_array< _Tp >::operator%= (const valarray< _Tp > & __v) const [inline, inherited]
Modulo slice elements by corresponding elements of v.
Definition at line 257 of file slice_array.h.
template<typename _Tp > void std::mask_array< _Tp >::operator%= (const valarray< _Tp > & __v) const [inline, inherited]
Modulo slice elements by corresponding elements of v.
Definition at line 191 of file mask_array.h.
template<typename _Tp > void std::indirect_array< _Tp >::operator%= (const valarray< _Tp > & __v) const [inline, inherited]
Modulo slice elements by corresponding elements of v.
Definition at line 195 of file indirect_array.h.
template<typename _Tp > void std::gslice_array< _Tp >::operator%= (const valarray< _Tp > & __v) const [inline, inherited]
Modulo slice elements by corresponding elements of v.
Definition at line 201 of file gslice_array.h.
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator%= (const valarray< _Tp > & __v) [inline, inherited]
Modulo elements of array by corresponding elements of v.
Definition at line 997 of file valarray.
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator%= (const _Tp & __t) [inline, inherited]
Set each element e of array to e % t. One scalar, every element, chaos coordinated π«
Definition at line 997 of file valarray.
π¦ operator&= β bitwise and bestie
template<typename _Tp > void std::slice_array< _Tp >::operator&= (const valarray< _Tp > & __v) const [inline, inherited]
Logical and slice elements with corresponding elements of v.
Definition at line 261 of file slice_array.h.
template<typename _Tp > void std::mask_array< _Tp >::operator&= (const valarray< _Tp > & __v) const [inline, inherited]
Logical and slice elements with corresponding elements of v.
Definition at line 195 of file mask_array.h.
template<typename _Tp > void std::indirect_array< _Tp >::operator&= (const valarray< _Tp > & __v) const [inline, inherited]
Logical and slice elements with corresponding elements of v.
Definition at line 199 of file indirect_array.h.
template<typename _Tp > void std::gslice_array< _Tp >::operator&= (const valarray< _Tp > & __v) const [inline, inherited]
Logical and slice elements with corresponding elements of v.
Definition at line 205 of file gslice_array.h.
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator&= (const valarray< _Tp > & __v) [inline, inherited]
Logical and corresponding elements of v with elements of array.
Definition at line 999 of file valarray.
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator&= (const _Tp & __t) [inline, inherited]
Set each element e of array to e & t.
Definition at line 999 of file valarray.
π operator*= β multiply era
template<typename _Tp > void std::slice_array< _Tp >::operator*= (const valarray< _Tp > & __v) const [inline, inherited]
Multiply slice elements by corresponding elements of v.
Definition at line 255 of file slice_array.h.
template<typename _Tp > void std::mask_array< _Tp >::operator*= (const valarray< _Tp > & __v) const [inline, inherited]
Multiply slice elements by corresponding elements of v.
Carry-over from the previous part: Definition at line 189 of file mask_array.h.
template<typename _Tp > void std::indirect_array< _Tp >::operator*= (const valarray< _Tp > & __v) const [inline, inherited]β multiplies the slice elements by the matching elements ofv. Definition at line 193 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator*= (const valarray< _Tp > & __v) const [inline, inherited]β multiplies the slice elements by the matching elements ofv. Definition at line 199 of filegslice_array.h.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator*= (const valarray< _Tp > & __v) [inline, inherited]β multiplies the arrayβs elements by the corresponding elements ofv. Definition at line 995 of filevalarray.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator*= (const _Tp & __t) [inline, inherited]β multiplies every element of the array byt. Definition at line 995 of filevalarray.template<typename _Tp > valarray< _Tp >::template _UnaryOp< __unary_plus >::_Rt std::valarray< _Tp >::operator+ () const [inline, inherited]β returns a brand-new valarray by applying unary+to every element. Definition at line 967 of filevalarray.template<typename _Tp > void std::slice_array< _Tp >::operator+= (const valarray< _Tp > & __v) const [inline, inherited]β adds the corresponding elements ofvinto the slice elements. Definition at line 258 of fileslice_array.h.template<typename _Tp > void std::mask_array< _Tp >::operator+= (const valarray< _Tp > & __v) const [inline, inherited]β adds the corresponding elements ofvinto the slice elements. Definition at line 192 of filemask_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator+= (const valarray< _Tp > & __v) const [inline, inherited]β adds the corresponding elements ofvinto the slice elements. Definition at line 196 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator+= (const valarray< _Tp > & __v) const [inline, inherited]β adds the corresponding elements ofvinto the slice elements. Definition at line 202 of filegslice_array.h.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator+= (const valarray< _Tp > & __v) [inline, inherited]β adds the corresponding elements ofvto the arrayβs elements. Definition at line 993 of filevalarray.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator+= (const _Tp & __t) [inline, inherited]β addstto every element of the array. Definition at line 993 of filevalarray.template<typename _Tp > valarray< _Tp >::template _UnaryOp< __negate >::_Rt std::valarray< _Tp >::operator- () const [inline, inherited]β returns a fresh valarray by applying unary-to every element. Definition at line 968 of filevalarray.template<typename _Tp > void std::slice_array< _Tp >::operator-= (const valarray< _Tp > & __v) const [inline, inherited]β subtracts the corresponding elements ofvfrom the slice elements. Definition at line 259 of fileslice_array.h.template<typename _Tp > void std::mask_array< _Tp >::operator-= (const valarray< _Tp > & __v) const [inline, inherited]β subtracts the corresponding elements ofvfrom the slice elements. Definition at line 193 of filemask_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator-= (const valarray< _Tp > & __v) const [inline, inherited]β subtracts the corresponding elements ofvfrom the slice elements. Definition at line 197 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator-= (const valarray< _Tp > & __v) const [inline, inherited]β subtracts the corresponding elements ofvfrom the slice elements. Definition at line 203 of filegslice_array.h.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator-= (const valarray< _Tp > & __v) [inline, inherited]β subtracts the corresponding elements ofvfrom the arrayβs elements. Definition at line 994 of filevalarray.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator-= (const _Tp & __t) [inline, inherited]β subtractstfrom every element of the array. Definition at line 994 of filevalarray.template<typename _Tp > void std::slice_array< _Tp >::operator/= (const valarray< _Tp > & __v) const [inline, inherited]β divides the slice elements by the matching elements ofv. Definition at line 256 of fileslice_array.h.template<typename _Tp > void std::mask_array< _Tp >::operator/= (const valarray< _Tp > & __v) const [inline, inherited]β divides the slice elements by the matching elements ofv. Definition at line 190 of filemask_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator/= (const valarray< _Tp > & __v) const [inline, inherited]β divides the slice elements by the matching elements ofv. Definition at line 194 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator/= (const valarray< _Tp > & __v) const [inline, inherited]β divides the slice elements by the matching elements ofv. Definition at line 200 of filegslice_array.h.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator/= (const valarray< _Tp > & __v) [inline, inherited]β divides the arrayβs elements by the corresponding elements ofv. Definition at line 996 of filevalarray.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator/= (const _Tp & __t) [inline, inherited]β divides every element of the array byt. Definition at line 996 of filevalarray.template<typename _Tp > void std::slice_array< _Tp >::operator<<= (const valarray< _Tp > & __v) const [inline, inherited]β left-shifts the slice elements by the corresponding elements ofv. Definition at line 263 of fileslice_array.h.template<typename _Tp > void std::mask_array< _Tp >::operator<<= (const valarray< _Tp > & __v) const [inline, inherited]β left-shifts the slice elements by the corresponding elements ofv. Definition at line 197 of filemask_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator<<= (const valarray< _Tp > & __v) const [inline, inherited]β left-shifts the slice elements by the corresponding elements ofv. Definition at line 201 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator<<= (const valarray< _Tp > & __v) const [inline, inherited]β left-shifts the slice elements by the corresponding elements ofv. Definition at line 207 of filegslice_array.h.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator<<= (const valarray< _Tp > & __v) [inline, inherited]β left-shifts the arrayβs elements by the corresponding elements ofv. Definition at line 1001 of filevalarray.template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator<<= (const _Tp & __t) [inline, inherited]β left-shifts every elementeof the array bytbits. Definition at line 1001 of filevalarray.template<typename _Tp > void std::slice_array< _Tp >::operator= (const valarray< _Tp > & __v) const [inline, inherited]β assigns the slice elements to the corresponding elements ofv. Definition at line 228 of fileslice_array.h.template<typename _Tp > void std::slice_array< _Tp >::operator= (const _Tp & __t) const [inline, inherited]β assigns every slice element tot. Definition at line 223 of fileslice_array.h.template<typename _Tp > slice_array< _Tp > & std::slice_array< _Tp >::operator= (const slice_array< _Tp > & __a) [inline, inherited]β assignment operator: assigns the slice elements to the corresponding elements ofa. Refs:std::slice_array< _Tp >::_M_array,std::slice_array< _Tp >::_M_stride, andstd::slice_array< _Tp >::_M_sz. Definition at line 214 of fileslice_array.h.template<typename _Tp > void std::mask_array< _Tp >::operator= (const _Tp & __t) const [inline, inherited]β assigns every slice element tot. Definition at line 157 of filemask_array.h.template<typename _Tp > mask_array< _Tp > & std::mask_array< _Tp >::operator= (const mask_array< _Tp > & __a) [inline, inherited]β assignment operator: assigns the elements to the corresponding elements ofa. Refs:std::mask_array< _Tp >::_M_array, andstd::mask_array< _Tp >::_M_mask. Definition at line 148 of filemask_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator= (const valarray< _Tp > & __v) const [inline, inherited]β assigns the slice elements to the corresponding elements ofv. Definition at line 167 of fileindirect_array.h.template<typename _Tp > void std::indirect_array< _Tp >::operator= (const _Tp & __t) const [inline, inherited]β assigns every slice element tot. Definition at line 162 of fileindirect_array.h.template<typename _Tp > indirect_array< _Tp > & std::indirect_array< _Tp >::operator= (const indirect_array< _Tp > & __a) [inline, inherited]β assignment operator: assigns the elements to the corresponding elements ofa. Refs:std::indirect_array< _Tp >::_M_array, andstd::indirect_array< _Tp >::_M_index. Definition at line 153 of fileindirect_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator= (const valarray< _Tp > & __v) const [inline, inherited]β assigns the slice elements to the corresponding elements ofv. Refs:std::valarray< _Tp >::size(). Definition at line 165 of filegslice_array.h.template<typename _Tp > void std::gslice_array< _Tp >::operator= (const _Tp & __t) const [inline, inherited]β assigns every slice element tot. Refs:std::valarray< _Tp >::size(). Definition at line 157 of filegslice_array.h.template<typename _Tp > gslice_array< _Tp > & std::gslice_array< _Tp >::operator= (const gslice_array< _Tp > & __a) [inline, inherited]β assignment operator: assigns the slice elements to the corresponding elements ofa. Refs:std::gslice_array< _Tp >::_M_array,std::gslice_array< _Tp >::_M_index, andstd::valarray< _Tp >::size(). Definition at line 147 of filegslice_array.h.gslice & std::gslice::operator= (const gslice & __g) [inline, inherited]β assignment operator. Refs:std::gslice::_M_index. Definition at line 168 of filegslice.h.template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator= (const indirect_array< _Tp > & __ia) [inline, inherited]β assigns elements to an array subset π . It assigns the elements of the array to the values inia. Results are undefined ifiadoes not have the same size as this array. Parameter:iaβ array slice to get values from. Refs:std::indirect_array< _Tp >::_M_array,std::indirect_array< _Tp >::_M_index, andstd::indirect_array< _Tp >::_M_sz. Definition at line 727 of filevalarray.template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator= (const mask_array< _Tp > & __ma) [inline, inherited]β assigns elements to an array subset β¨. It assigns the elements of the array to the values inma. Results are undefined ifmadoes not have the same size as this array. Parameter:maβ array slice to get values from. Definition at line 717 of filevalarray.
References: std::mask_array< _Tp >::_M_array, std::mask_array< _Tp >::_M_mask, and std::mask_array< _Tp >::_M_sz.
π«Ά operator= from gslice_array β subset assignment, slay
template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator=(const gslice_array< _Tp > & __ga) [inline, inherited]
Assign elements to an array subset. Assign elements of array to values in ga.
Results are undefined if ga does not have the same size as this array. Do not skip the size check, bestie π
Parameters:
gaβ Array slice to get values from.
Definition: line 707 of file valarray.
References: std::gslice_array< _Tp >::_M_array, std::gslice_array< _Tp >::_M_index, and std::valarray< _Tp >::size().
πΈ operator= from slice_array β assign the slice subset
template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator=(const slice_array< _Tp > & __sa) [inline, inherited]
Assign elements to an array subset. Assign elements of array to values in sa.
Results are undefined if sa does not have the same size as this array. Size mismatch = chaos, fr fr π
Parameters:
saβ Array slice to get values from.
Definition: line 697 of file valarray.
References: std::slice_array< _Tp >::_M_array, std::slice_array< _Tp >::_M_stride, and std::slice_array< _Tp >::_M_sz.
π operator= with a value β fill the whole vibe
template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator=(const _Tp & __t) [inline, inherited]
Assign elements to a value. Assign all elements of array to t. Every single one, no cap β¨
Parameters:
tβ Value for elements.
Definition: line 689 of file valarray.
π¦ operator= from initializer_list β list-to-array moment
template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator=(initializer_list< _Tp > __l) [inline, inherited]
Assign elements to an initializer_list. Assign elements of array to values in l.
Results are undefined if l does not have the same size as this array. Same-size check is the main character here π
Parameters:
lβinitializer_listto get values from.
Definition: line 680 of file valarray.
References: std::initializer_list< _E >::begin(), and std::initializer_list< _E >::size().
π operator= from another valarray β copy the whole array
template<typename _Tp> valarray< _Tp > & std::valarray< _Tp >::operator=(const valarray< _Tp > & __v) [inline, inherited]
Assign elements to an array. Assign elements of array to values in v.
Results are undefined if v does not have the same size as this array. Please respect the size equality, bestie π
Parameters:
vβ Valarray to get values from.
Definition: line 670 of file valarray.
References: std::valarray< _Tp >::_M_data, and std::valarray< _Tp >::_M_size.
π slice_array::operator>>= β right shift the slice
template<typename _Tp > void std::slice_array< _Tp >::operator>>= (const valarray< _Tp > & __v) const [inline, inherited]
Right shift slice elements by corresponding elements of v. Bit-shift energy, iconic π«Ά
Definition: line 264 of file slice_array.h.
π mask_array::operator>>= β right shift the masked subset
template<typename _Tp > void std::mask_array< _Tp >::operator>>= (const valarray< _Tp > & __v) const [inline, inherited]
Right shift slice elements by corresponding elements of v.
Definition: line 198 of file mask_array.h.
π indirect_array::operator>>= β right shift the indirect subset
template<typename _Tp > void std::indirect_array< _Tp >::operator>>= (const valarray< _Tp > & __v) const [inline, inherited]
Right shift slice elements by corresponding elements of v.
Definition: line 202 of file indirect_array.h.
π gslice_array::operator>>= β right shift the gslice subset
template<typename _Tp > void std::gslice_array< _Tp >::operator>>= (const valarray< _Tp > & __v) const [inline, inherited]
Right shift slice elements by corresponding elements of v.
Definition: line 208 of file gslice_array.h.
π₯ valarray::operator>>= with a valarray β right shift all the things
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator>>= (const valarray< _Tp > & __v) [inline, inherited]
Right shift elements of array by corresponding elements of v. Corresponding means matching, bestie β not random π
Definition: line 1002 of file valarray.
π₯ valarray::operator>>= with a value β right shift by t bits
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator>>= (const _Tp & __t) [inline, inherited]
Right shift each element e of array by t bits.
Definition: line 1002 of file valarray.
π¦ operator[] with a valarray< size_t > β reference a subset by index list
template<typename _Tp > indirect_array< _Tp > std::valarray< _Tp >::operator[] (const valarray< size_t > & __i) [inline, inherited]
Return a reference to an array subset.
Returns an indirect_array referencing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to include in the subset. The returned indirect_array refers to these elements. Indirect but still direct enough, iykyk β¨
Parameters:
iβ Thevalarrayelement index list.
Returns: Indirect_array referencing elements in i.
Definition: line 807 of file valarray.
References: std::valarray< _Tp >::size().
π¦ operator[] with a valarray< size_t >, const β copy a subset by index list
template<typename _Tp > _Expr< _IClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] (const valarray< size_t > & __i) const [inline, inherited]
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the argument. The elements in the argument are interpreted as the indices of elements of this valarray to copy to the return valarray. New array, who dis? π
Parameters:
iβ Thevalarrayelement index list.
Returns: New valarray containing elements in s.
Definition: line 799 of file valarray.
π operator[] with a valarray< bool > β mask-array reference moment
template<typename _Tp > mask_array< _Tp > std::valarray< _Tp >::operator[] (const valarray< bool > & __m) [inline, inherited]
Return a reference to an array subset.
Returns a new mask_array referencing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements are part of the subset. Elements of the array are part of the subset if the corresponding element of the argument is true. Mask on, facts first π
Parameters:
mβ Thevalarraybitmask.
Returns: New valarray containing elements indicated by m.
Definition: line 788 of file valarray.
References: std::valarray< _Tp >::size().
π operator[] with a valarray< bool >, const β copy the masked subset
template<typename _Tp > valarray< _Tp > std::valarray< _Tp >::operator[] (const valarray< bool > & __m) const [inline, inherited]
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the argument. The input is a valarray of bool which represents a bitmask indicating which elements should be copied into the new valarray. Each element of the array is added to the return valarray if the corresponding element of the argument is true. True means invited, false means not on the list π
Parameters:
mβ Thevalarraybitmask.
Returns: New valarray containing elements indicated by m.
Definition: line 776 of file valarray.
References: std::valarray< _Tp >::size().
π operator[] with a gslice β reference the gslice subset
template<typename _Tp > gslice_array< _Tp > std::valarray< _Tp >::operator[] (const gslice & __gs) [inline, inherited]
Return a reference to an array subset.
Returns a new valarray containing the elements of the array indicated by the gslice argument. The new valarray has the same size as the input gslice. Generalized slice said βIβll take it from hereβ β¨
See also: gslice.
Parameters:
sβ The sourcegslice.
Returns: New valarray containing elements in s.
Definition: line 768 of file valarray.
References: std::gslice::_M_index.
π operator[] with a gslice, const β slice-array-ish subset
template<typename _Tp > _Expr< _GClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] (const gslice & __gs) const [inline, inherited]
Return an array subset.
Returns a slice_array referencing the elements of the array indicated by the slice argument.
See also: gslice.
Parameters:
sβ The source slice.
Returns: Slice_array referencing elements indicated by s.
Definition: line 759 of file valarray.
References: std::gslice::_M_index.
π operator[] with a slice β reference the slice subset
template<typename _Tp > slice_array< _Tp > std::valarray< _Tp >::operator[] (slice __s) [inline, inherited]
Return a reference to an array subset.
Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray has the same size as the input slice. Slice it, reference it, slay it π
See also: slice.
Parameters:
sβ The source slice.
Returns: New valarray containing elements in s.
Definition: line 754 of file valarray.
π operator[] with a slice, const β copy the slice subset
template<typename _Tp > _Expr< _SClos< _ValArray, _Tp >, _Tp > std::valarray< _Tp >::operator[] (slice __s) const [inline, inherited]
Return an array subset.
Returns a new valarray containing the elements of the array indicated by the slice argument. The new valarray has the same size as the input slice.
See also: slice.
Parameters:
sβ The source slice.
Returns: New valarray containing elements in s.
Definition: line 746 of file valarray.
β operator[] with a size_t β the classic index reference
template<typename _Tp > _Tp & std::valarray< _Tp >::operator[] (size_t __i) [inline, inherited]
Return a reference to the i'th array element. Singular element, singular serve π
Parameters:
iβ Index of element to return.
Returns: Reference to the i'th element.
Definition: line 552 of file valarray.
π§ slice_array::operator^= β logical xor the slice
template<typename _Tp > void std::slice_array< _Tp >::operator^= (const valarray< _Tp > & __v) const [inline, inherited]
Logical xor slice elements with corresponding elements of v. Exclusive-or said βnot both, bestieβ β¨
Definition: line 260 of file slice_array.h.
π§ mask_array::operator^= β logical xor the masked subset
template<typename _Tp > void std::mask_array< _Tp >::operator^= (const valarray< _Tp > & __v) const [inline, inherited]
Logical xor slice elements with corresponding elements of v.
Definition: line 194 of file mask_array.h.
π§ indirect_array::operator^= β logical xor the indirect subset
template<typename _Tp > void std::indirect_array< _Tp >::operator^= (const valarray< _Tp > & __v) const [inline, inherited]
Logical xor slice elements with corresponding elements of v.
Definition: line 198 of file indirect_array.h.
π§ gslice_array::operator^= β logical xor the gslice subset
template<typename _Tp > void std::gslice_array< _Tp >::operator^= (const valarray< _Tp > & __v) const [inline, inherited]
Logical xor slice elements with corresponding elements of v.
Definition: line 204 of file gslice_array.h.
π valarray::operator^= with a valarray β xor all the corresponding elements
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator^= (const valarray< _Tp > & __v) [inline, inherited]
Logical xor corresponding elements of v with elements of array. One-to-one xor correspondence, no cap π
Definition: line 998 of file valarray.
π valarray::operator^= with a value β xor every element
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator^= (const _Tp & __t) [inline, inherited]
Set each element e of array to e ^ t.
Definition: line 998 of file valarray.
πΈ slice_array::operator|= β logical or the slice
template<typename _Tp > void std::slice_array< _Tp >::operator|= (const valarray< _Tp > & __v) const [inline, inherited]
Logical or slice elements with corresponding elements of v. Or means either one can carry the vibe π«Ά
Definition: line 262 of file slice_array.h.
πΈ mask_array::operator|= β logical or the masked subset
template<typename _Tp > void std::mask_array< _Tp >::operator|= (const valarray< _Tp > & __v) const [inline, inherited]
Logical or slice elements with corresponding elements of v.
Definition: line 196 of file mask_array.h.
πΈ indirect_array::operator|= β logical or the indirect subset
template<typename _Tp > void std::indirect_array< _Tp >::operator|= (const valarray< _Tp > & __v) const [inline, inherited]
Logical or slice elements with corresponding elements of v.
Definition: line 200 of file indirect_array.h.
πΈ gslice_array::operator|= β logical or the gslice subset
template<typename _Tp > void std::gslice_array< _Tp >::operator|= (const valarray< _Tp > & __v) const [inline, inherited]
Logical or slice elements with corresponding elements of v.
Definition: line 206 of file gslice_array.h.
π§‘ operator|= β the valarray version
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator|=
(const valarray< _Tp > & __v) [inline, inherited]
okay so this one does a logical or of corresponding elements of v with elements of array. slay. Definition at line 1000 of file valarray.
π§‘ operator|= β the _Tp version
template<class _Tp> valarray< _Tp > & std::valarray< _Tp >::operator|=
(const _Tp & __t) [inline, inherited]
Set each element e of array to e | t. periodt. Definition at line 1000 of file valarray.
πΈ operator~
template<typename _Tp > valarray< _Tp >::template _UnaryOp< __bitwise_not
>::_Rt std::valarray< _Tp >::operator~ () const [inline, inherited]
Return a new valarray by applying unary ~ to each element. cute little bit-flipper. Definition at line 969 of file valarray.
π resize
template<class _Tp> void std::valarray< _Tp >::resize (size_t __size, _Tp
__c = _Tp()) [inline, inherited]
Resize array.
Resize this array to size and set all elements to c. All references and iterators are invalidated. bestie, that part matters π
Parameters:
- size β New array size.
- c β New value for all elements.
Definition at line 910 of file valarray.
π¦ shift
template<class _Tp > valarray< _Tp > std::valarray< _Tp >::shift (int __n)
const [inline, inherited]
Return a shifted array.
A new valarray is constructed as a copy of this array with elements in shifted positions. For an element with index i, the new position is i - n. The new valarray has the same size as the current one. New elements without a value are set to 0. Elements whose new position is outside the bounds of the array are discarded.
Positive arguments shift toward index 0, discarding elements [0, n). Negative arguments discard elements from the top of the array.
Parameters:
- n β Number of element positions to shift.
Returns:
- New
valarraywith elements in shifted positions.
Definition at line 828 of file valarray.
References std::valarray< _Tp >::_M_data, and std::valarray< _Tp >::_M_size.
π slice::size
size_t std::slice::size () const [inline, inherited]
Return size of slice. Definition at line 101 of file slice_array.h.
π gslice::size
valarray< size_t > std::gslice::size () const [inline, inherited]
Return array of sizes of slice dimensions. Definition at line 137 of file gslice.h.
π valarray::size
template<class _Tp > size_t std::valarray< _Tp >::size () const [inline,
inherited]
Return the number of elements in array. Definition at line 815 of file valarray.
Referenced by std::valarray< _Tp >::operator=(), std::gslice_array< _Tp >::operator=(), and std::valarray< _Tp >::operator[]().
π slice::slice β the big constructor
std::slice::slice (size_t __o, size_t __d, size_t __s) [inline, inherited]
Construct a slice.
Parameters:
- o β Offset in array of first element.
- d β Number of elements in slice.
- s β Stride between array elements.
Definition at line 93 of file slice_array.h.
π slice::slice β the empty one
std::slice::slice () [inline, inherited]
Construct an empty slice. Definition at line 89 of file slice_array.h.
π slice_array::slice_array β copy constructor
template<typename _Tp > std::slice_array< _Tp >::slice_array (const
slice_array< _Tp > & a) [inline, inherited]
Copy constructor. Both slices refer to the same underlying array. Definition at line 206 of file slice_array.h.
β slice::start
size_t std::slice::start () const [inline, inherited]
Return array offset of first slice element. Definition at line 97 of file slice_array.h.
β gslice::start
size_t std::gslice::start () const [inline, inherited]
Return array offset of first slice element. Definition at line 133 of file gslice.h.
β slice::stride
size_t std::slice::stride () const [inline, inherited]
Return array stride of slice. Definition at line 105 of file slice_array.h.
β gslice::stride
valarray< size_t > std::gslice::stride () const [inline, inherited]
Return array of array strides for each dimension. Definition at line 141 of file gslice.h.
π₯ sum
template<class _Tp > _Tp std::valarray< _Tp >::sum () const [inline,
inherited]
Return the sum of all elements in the array.
Accumulates the sum of all elements into a Tp using +=. The order of adding the elements is unspecified. no cap, thatβs the whole note. Definition at line 820 of file valarray.
π§ valarray β initializer_list constructor
template<typename _Tp> std::valarray< _Tp >::valarray (initializer_list< _Tp
> __l) [inline, inherited]
Construct an array with an initializer_list of values. Definition at line 649 of file valarray.
References std::initializer_list< _E >::begin(), and std::initializer_list< _E >::end().
π§ valarray β indirect_array constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const indirect_array<
_Tp > & __ia) [inline, inherited]
Construct an array with the same size and values in ia. Definition at line 639 of file valarray.
References std::indirect_array< _Tp >::_M_array, and std::indirect_array< _Tp >::_M_index.
π§ valarray β mask_array constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const mask_array< _Tp
> & __ma) [inline, inherited]
Construct an array with the same size and values in ma. Definition at line 630 of file valarray.
References std::mask_array< _Tp >::_M_array, and std::mask_array< _Tp >::_M_mask.
π§ valarray β gslice_array constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const gslice_array<
_Tp > & __ga) [inline, inherited]
Construct an array with the same size and values in ga. Definition at line 619 of file valarray.
References std::gslice_array< _Tp >::_M_array, and std::gslice_array< _Tp >::_M_index.
π§ valarray β slice_array constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const slice_array<
_Tp > & __sa) [inline, inherited]
Construct an array with the same size and values in sa. Definition at line 610 of file valarray.
References std::slice_array< _Tp >::_M_array, std::slice_array< _Tp >::_M_stride, and std::slice_array< _Tp >::_M_sz.
π§ valarray β copy constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const valarray< _Tp >
& __v) [inline, inherited]
Copy constructor. Definition at line 603 of file valarray.
References std::valarray< _Tp >::_M_data.
π§ valarray β fill constructor
template<typename _Tp> std::valarray< _Tp >::valarray (const _Tp & __t,
size_t __n) [inline, inherited]
Construct an array with n elements initialized to t. Definition at line 588 of file valarray.
π§ valarray β size constructor
template<typename _Tp > std::valarray< _Tp >::valarray (size_t __n) [inline,
explicit, inherited]
Construct an array with n elements. Definition at line 582 of file valarray.
π§ valarray β default constructor
template<typename _Tp > std::valarray< _Tp >::valarray () [inline,
inherited]
Construct an empty array. Definition at line 578 of file valarray.
π gslice::~gslice
std::gslice::~gslice () [inline, inherited]
Destructor. Definition at line 161 of file gslice.h.
π AUTHOR
Generated automatically by Doxygen for libstdc++ from the source code.
okay bestie, thatβs the whole page β source/version libstdc++, date 21 Apr 2009, and itβs the Numeric Arrays(3) manpage. go off π
β¨π«Ά
π¦ where this page comes from
- nixpkgs unstable: std-man-pages 4.4.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms