STD::GSLICE_ARRAY(3cxx)

🫢 std::gslice_array< _Tp > 🫢

Okay bestie, welcome to the std::gslice_array< _Tp > page from the 3cxx manual β€” yes, that 3cxx. This whole page is about a very specific little reference-to-a-multi-dimensional-subset situation, and we're gonna keep every detail while making it actually fun to read. πŸ’…


🌸 NAME 🌸

std::gslice_array< _Tp > β€” reference to a multi-dimensional subset of an array. That's the whole name-and-blurb combo, and it ate. ✨


✨ SYNOPSIS ✨

#include <valarray>

πŸŽ€ Public Types πŸŽ€

  • typedef _Tp value_type β€” the element type gets its cute alias moment. πŸ¦‹

πŸ’– Public Member Functions πŸ’–

  • gslice_array (const gslice_array &) β€” copy constructor, and no cap: both slices refer to the same underlying array. Both of them. Same array. Iconic shared-reference behavior. πŸ’«
  • template<class _Dom > void operator%= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of modulo assignment, exactly as listed here with no extra one-liner on the page. πŸŽ€
  • void operator%= (const valarray< _Tp > &) const β€” modulo slice elements by corresponding elements of v.
  • template<class _Dom > void operator&= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of logical-and assignment.
  • void operator&= (const valarray< _Tp > &) const β€” logical and slice elements with corresponding elements of v.
  • template<class _Dom > void operator*= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of multiply-assignment.
  • void operator*= (const valarray< _Tp > &) const β€” multiply slice elements by corresponding elements of v.
  • template<class _Dom > void operator+= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of add-assignment.
  • void operator+= (const valarray< _Tp > &) const β€” add corresponding elements of v to slice elements.
  • template<class _Dom > void operator-= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of subtract-assignment.
  • void operator-= (const valarray< _Tp > &) const β€” subtract corresponding elements of v from slice elements.
  • template<class _Dom > void operator/= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of divide-assignment.
  • void operator/= (const valarray< _Tp > &) const β€” divide slice elements by corresponding elements of v.
  • template<class _Dom > void operator<<= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of left-shift assignment.
  • void operator<<= (const valarray< _Tp > &) const β€” left shift slice elements by corresponding elements of v.
  • template<class _Dom > void operator= (const _Expr< _Dom, _Tp > &) const β€” the _Expr assignment overload, sitting right here with no separate description on the page.
  • void operator= (const _Tp &) const β€” assign all slice elements to t.
  • gslice_array & operator= (const gslice_array &) β€” assignment operator. Assigns slice elements to corresponding elements of a.
  • void operator= (const valarray< _Tp > &) const β€” assign slice elements to corresponding elements of v.
  • template<class _Dom > void operator>>= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of right-shift assignment.
  • void operator>>= (const valarray< _Tp > &) const β€” right shift slice elements by corresponding elements of v.
  • template<class _Dom > void operator^= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of logical-xor assignment.
  • void operator^= (const valarray< _Tp > &) const β€” logical xor slice elements with corresponding elements of v.
  • template<class _Dom > void operator|= (const _Expr< _Dom, _Tp > &) const β€” the _Expr overload of logical-or assignment.
  • void operator|= (const valarray< _Tp > &) const β€” logical or slice elements with corresponding elements of v.

🫢 Friends 🫢

  • class valarray< _Tp > β€” friendship status: confirmed. valarray is a friend of this class. πŸ₯Ή

πŸ’– Detailed Description πŸ’–

template<typename _Tp>
class std::gslice_array< _Tp >

A gslice_array is a reference to the actual elements of an array specified by a gslice. That's the whole main-character setup: it doesn't own a whole new copy of the world, it refers to the real elements in the original array. πŸ‘‘

The way to get a gslice_array is to call operator[](gslice) on a valarray. The returned gslice_array then permits carrying operations out on the referenced subset of elements in the original valarray. So you're not doing random busywork on a clone β€” you're working on the referenced subset. For example, operator+=(valarray) will add values to the subset of elements in the underlying valarray this gslice_array refers to. Slay, but make it element-wise. πŸ’…

🌸 Parameters 🌸

  • Tp β€” element type.

πŸ”₯ Member Function Documentation πŸ”₯

  • template<typename _Tp > void std::gslice_array< _Tp >::operator%= (const valarray< _Tp > &) const β€” modulo slice elements by corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator&= (const valarray< _Tp > &) const β€” logical and slice elements with corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator*= (const valarray< _Tp > &) const β€” multiply slice elements by corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator+= (const valarray< _Tp > &) const β€” add corresponding elements of v to slice elements.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator-= (const valarray< _Tp > &) const β€” subtract corresponding elements of v from slice elements.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator/= (const valarray< _Tp > &) const β€” divide slice elements by corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator<<= (const valarray< _Tp > &) const β€” left shift slice elements by corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator>>= (const valarray< _Tp > &) const β€” right shift slice elements by corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator^= (const valarray< _Tp > &) const β€” logical xor slice elements with corresponding elements of v.
  • template<typename _Tp > void std::gslice_array< _Tp >::operator|= (const valarray< _Tp > &) const β€” logical or slice elements with corresponding elements of v.

🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code. Very β€œthe robot wrote it so you don't have to” energy. πŸ€–βœ¨


Source/version: libstdc++ β€” this page is from the 3cxx manual section. Date: the page itself doesn't print one, so no date to quote, and we're not out here inventing facts. It's giving timeless. Bye bestie, go slice that multi-dimensional subset responsibly πŸ’…πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from