STD::MASK_ARRAY(3cxx)

okay bestie, sit down, hydrate, and get comfy: this is the manual page for std::mask_array< _Tp >, from the C++ docs, section 3cxx. It’s literally β€œReference to selected subset of an array,” and it’s giving backstage-pass energy to a valarray. πŸ’…βœ¨

πŸ’– NAME πŸ’–

std::mask_array< _Tp > β€” Reference to selected subset of an array. That’s the whole name, no cap. 🫢

✨ SYNOPSIS ✨

First things first, you gotta include the header, bestie:

#include <valarray>

🌸 Public Types 🌸

  • typedef _Tp value_type β€” the element type, just vibing as value_type.

🧚 Public Member Functions 🧚

Okay, this is the main-character list. Every overload is here, and yes, we’re listing all of them. πŸŽ€

  • mask_array (const mask_array &) β€” Copy constructor. Both slices refer to the same underlying array β€” same underlying tea, two sippers. πŸ«–
  • operator%= β€” Modulo slice elements by corresponding elements of v.
    • template<class _Dom > void operator%= (const _Expr< _Dom, _Tp > &) const
    • void operator%= (const valarray< _Tp > &) const
  • operator&= β€” 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
  • operator*= β€” Multiply slice elements by corresponding elements of v.
    • template<class _Dom > void operator*= (const _Expr< _Dom, _Tp > &) const
    • void operator*= (const valarray< _Tp > &) const
  • operator+= β€” Add corresponding elements of v to slice elements.
    • template<class _Dom > void operator+= (const _Expr< _Dom, _Tp > &) const
    • void operator+= (const valarray< _Tp > &) const
  • operator-= β€” Subtract corresponding elements of v from slice elements.
    • template<class _Dom > void operator-= (const _Expr< _Dom, _Tp > &) const
    • void operator-= (const valarray< _Tp > &) const
  • operator/= β€” Divide slice elements by corresponding elements of v.
    • template<class _Dom > void operator/= (const _Expr< _Dom, _Tp > &) const
    • void operator/= (const valarray< _Tp > &) const
  • operator<<= β€” Left shift slice elements by corresponding elements of v.
    • template<class _Dom > void operator<<= (const _Expr< _Dom, _Tp > &) const
    • void operator<<= (const valarray< _Tp > &) const
  • operator= β€” the assignment overloads, all lined up:
    • template<class _Dom > void operator= (const _Expr< _Dom, _Tp > &) const
    • template<class _Ex > void operator= (const _Expr< _Ex, _Tp > &__e) const
    • void operator= (const _Tp &) const β€” Assign all slice elements to t.
    • mask_array & operator= (const mask_array &) β€” Assignment operator. Assigns elements to corresponding elements of a.
    • void operator= (const valarray< _Tp > &) const
  • operator>>= β€” 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
  • operator^= β€” 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
  • operator|= β€” Logical or slice elements with corresponding elements of v.
    • template<class _Dom > void operator|= (const _Expr< _Dom, _Tp > &) const
    • void operator|= (const valarray< _Tp > &) const

πŸ¦‹ Friends πŸ¦‹

  • class valarray< _Tp >

πŸ”₯ Detailed Description πŸ”₯

The docs literally print this class signature, stray quote and all β€” I’m keeping it exactly because we don’t edit the source tea:

template<class _Tp>
class std::mask_array< _Tp >"Reference to selected subset of an array.

Now the plot: a mask_array is a reference to the actual elements of an array specified by a bitmask in the form of an array of bool. The way to get a mask_array is to call operator[](valarray<bool>) on a valarray. The returned mask_array then permits carrying operations out on the referenced subset of elements in the original valarray. It’s like a VIP list for elements only. 🎟️

For example, if a mask_array is obtained using the array (false, true, false, true) as an argument, the mask array has two elements referring to array[1] and array[3] in the underlying array. Two little icons made it past the velvet rope. 🫢

πŸ“ Parameters πŸ“

  • Tp β€” Element type. That’s it, that’s the parameter.

🌈 Member Function Documentation 🌈

These are the ones the docs call out again, with their exact signatures. Yes, we’re repeating them because the manual does β€” consistency slay. πŸ’…

  • template<class _Tp > void std::mask_array< _Tp >::operator%= (const valarray< _Tp > &) const β€” Modulo slice elements by corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator&= (const valarray< _Tp > &) const β€” Logical and slice elements with corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator*= (const valarray< _Tp > &) const β€” Multiply slice elements by corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator+= (const valarray< _Tp > &) const β€” Add corresponding elements of v to slice elements.
  • template<class _Tp > void std::mask_array< _Tp >::operator-= (const valarray< _Tp > &) const β€” Subtract corresponding elements of v from slice elements.
  • template<class _Tp > void std::mask_array< _Tp >::operator/= (const valarray< _Tp > &) const β€” Divide slice elements by corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator<<= (const valarray< _Tp > &) const β€” Left shift slice elements by corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator>>= (const valarray< _Tp > &) const β€” Right shift slice elements by corresponding elements of v.
  • template<class _Tp > void std::mask_array< _Tp >::operator^= (const valarray< _Tp > &) const β€” Logical xor slice elements with corresponding elements of v.
  • template<class _Tp > void std::mask_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. The robots wrote this one, and honestly they ate. πŸ€–βœ¨


πŸ’– source/version: libstdc++ Β· page: std::mask_array< _Tp >(3cxx) Β· date: no date shown on this page, bestie. mwah πŸ’‹

πŸ“¦ where this page comes from