STD::INDIRECT_ARRAY(3)

✨ std::indirect_array< _Tp > ✨

okay bestie, welcome to the Library Functions Manual entry for std::indirect_array< _Tp > πŸ’– no cap, this is a whole vibe.

🌸 NAME 🌸

std::indirect_array< _Tp > β€” Reference to arbitrary subset of an array.


πŸŽ€ SYNOPSIS πŸŽ€

#include <valarray>

πŸ’… Public Types

  • typedef _Tp value_type

πŸ¦‹ Public Member Functions

  • indirect_array (const indirect_array &) β€” Copy constructor. Both slices refer to the same underlying array. (yes, same underlying array, they're literally sharing, it's giving twins πŸ‘―)
  • template<class _Dom> void operator%= (const _Expr< _Dom, _Tp > &) const
  • void operator%= (const valarray< _Tp > &) const β€” Modulo slice elements by corresponding elements of v.
  • template<class _Dom> void operator&= (const _Expr< _Dom, _Tp > &) const
  • 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
  • void operator*= (const valarray< _Tp > &) const β€” Multiply slice elements by corresponding elements of v.
  • template<class _Dom> void operator+= (const _Expr< _Dom, _Tp > &) const
  • void operator+= (const valarray< _Tp > &) const β€” Add corresponding elements of v to slice elements.
  • template<class _Dom> void operator-= (const _Expr< _Dom, _Tp > &) const
  • void operator-= (const valarray< _Tp > &) const β€” Subtract corresponding elements of v from slice elements.
  • template<class _Dom> void operator/= (const _Expr< _Dom, _Tp > &) const
  • void operator/= (const valarray< _Tp > &) const β€” Divide slice elements by corresponding elements of v.
  • template<class _Dom> void operator<<= (const _Expr< _Dom, _Tp > &) const
  • 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
  • void operator= (const _Tp &) const β€” Assign all slice elements to t.
  • indirect_array & operator= (const indirect_array &) β€” Assignment operator. Assigns 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
  • 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
  • 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
  • void operator|= (const valarray< _Tp > &) const β€” Logical or slice elements with corresponding elements of v.

🌈 Friends

  • class gslice_array< _Tp >
  • class valarray< _Tp >

πŸ’œ Detailed Description πŸ’œ

template<class _Tp>
class std::indirect_array< _Tp >

Reference to arbitrary subset of an array.

ok so picture this 🫢 β€” an indirect_array is a reference to the actual elements of an array, and which elements it points at is decided by an ordered array of indices. It's not a copy, bestie, it's a little window into the real thing.

The way to get an indirect_array is to call operator[](valarray<size_t>) on a valarray. The returned indirect_array then permits carrying operations out on the referenced subset of elements in the original valarray. So you grab your lil slice, you do your math, and the original array is the one that actually changed. main character energy, honestly ✨

For example, if an indirect_array is obtained using the array (4,2,0) as an argument, and then assigned to an array containing (1,2,3), then the underlying array will have array[0]==3, array[2]==2, and array[4]==1. the way that index 0 gets the THIRD value… yeah it's flipped, that's the whole point, it's indexed by the index list πŸŽ€

🧚 Parameters

  • Tp β€” Element type.

⭐ Member Function Documentation ⭐

template<class _Tp> void std::indirect_array< _Tp >::operator%= (const valarray< _Tp > & ) const

Modulo slice elements by corresponding elements of v. πŸ’€

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

Logical and slice elements with corresponding elements of v.

template<class _Tp> void std::indirect_array< _Tp >::operator*= (const valarray< _Tp > & ) const

Multiply slice elements by corresponding elements of v.

template<class _Tp> void std::indirect_array< _Tp >::operator+= (const valarray< _Tp > & ) const

Add corresponding elements of v to slice elements.

template<class _Tp> void std::indirect_array< _Tp >::operator-= (const valarray< _Tp > & ) const

Subtract corresponding elements of v from slice elements.

template<class _Tp> void std::indirect_array< _Tp >::operator/= (const valarray< _Tp > & ) const

Divide slice elements by corresponding elements of v.

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

Left shift slice elements by corresponding elements of v.

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

Right shift slice elements by corresponding elements of v.

template<class _Tp> void std::indirect_array< _Tp >::operator^= (const valarray< _Tp > & ) const

Logical xor slice elements with corresponding elements of v.

template<class _Tp> void std::indirect_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.


and that's the whole page, bestie πŸ₯° this one's from libstdc++, and it's filed in the manual as std::indir...ray< _Tp >(3) β€” go forth and slice, ily, bye πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms