std::indirect_array (3) - Linux Manuals
std::indirect_array: std::indirect_array
Command to display std::indirect_array
manual in Linux: $ man 3 std::indirect_array
NAME
std::indirect_array - std::indirect_array
Synopsis
Defined in header <valarray>
template< class T > class indirect_array;
std::gslice_array is a helper template used by std::indirect_array subscript operator. It has reference semantics to a subset of the array specified by an indirect array (std::valarray<std::size_t> object).
Member types
Type Definition
value_type T
Member functions
constructs a indirect_array
constructor (public member function)
destroys a indirect_array
destructor (public member function)
assigns contents
operator= (public member function)
operator+=
operator-=
operator*=
operator/= performs arithmetic operation on the array referred by indirect array.
operator%= (public member function)
operator&=
operator|=
operator^=
operator<<=
operator>>=
Example
// Run this code
#include <iostream>
#include <valarray>
int main()
{
std::valarray<int> data = {0,1,2,3,4,5,6,7,8,9};
std::valarray<std::size_t> idx = {0,2,4,6,8};
std::cout << "Original valarray: ";
for(int n: data) std::cout << n << ' ';
std::cout << '\n';
data[idx] += data[idx]; // double the values at indexes 'idx'
// the type of data[idx] is std::indirect_array<int>
std::cout << "After indirect modification: ";
for(int n: data) std::cout << n << ' ';
std::cout << '\n';
}
Output:
Original valarray: 0 1 2 3 4 5 6 7 8 9
After indirect modification: 0 1 4 3 8 5 12 7 16 9
Pages related to std::indirect_array
- std::indirect_array<T>::indirect_array (3) - std::indirect_array<T>::indirect_array
- std::indirect_array<T>::operator= (3) - std::indirect_array<T>::operator=
- std::indirect_array<T>::~indirect_array (3) - std::indirect_array<T>::~indirect_array
- std::independent_bits_engine (3) - std::independent_bits_engine
- std::independent_bits_engine<Engine,W,UIntType>::base (3) - std::independent_bits_engine<Engine,W,UIntType>::base
- std::independent_bits_engine<Engine,W,UIntType>::discard (3) - std::independent_bits_engine<Engine,W,UIntType>::discard
- std::independent_bits_engine<Engine,W,UIntType>::independent_bits_engine (3) - std::independent_bits_engine<Engine,W,UIntType>::independent_bits_engine
- std::independent_bits_engine<Engine,W,UIntType>::max (3) - std::independent_bits_engine<Engine,W,UIntType>::max
- std::independent_bits_engine<Engine,W,UIntType>::min (3) - std::independent_bits_engine<Engine,W,UIntType>::min
- std::independent_bits_engine<Engine,W,UIntType>::operator() (3) - std::independent_bits_engine<Engine,W,UIntType>::operator()
- std::independent_bits_engine<Engine,W,UIntType>::seed (3) - std::independent_bits_engine<Engine,W,UIntType>::seed
- std::in_place,std::in_place_type,std::in_place_index,std::in_place_t, (3) - std::in_place,std::in_place_type,std::in_place_index,std::in_place_t,