Rogue Wave banner
Previous fileTop of documentContentsIndexNext file

indirect_array


Valarray helpers

Summary

A numeric array class used to represent elements selected from a valarray.

Data Type and Member Function Indexes
(exclusive of constructors and destructors)

Synopsis

#include <valarray>
template <class T>
class indirect_array ;

Description

indirect_array<T> creates a selective view into a valarray. Indirect_arrays are produced by applying the indirect subscript operator to a valarray. The indirect array produced by this subscript contains only the elements of the valarray whose indices appear as values in the argument. The elements in an indirect_array are references to selected elements in the valarray (so changing an element in the indirect_array really changes the corresponding element in the valarray). An indirect_array does not itself hold any distinct elements. The template cannot be instantiated directly since all its constructors are private. However, you can copy an indirect_array to a valarray using either the valarray copy constructor or the assignment operator. Reference semantics are lost at that point.

Interface

template <class T> class indirect_array {
public:

  // types
  typedef T value_type;

  // destructor
  ~indirect_array();

  // public assignment
  void operator= (const valarray<T>& array) const;
  // computed assignment
  void operator*= (const valarray<T>& array) const;
  void operator/= (const valarray<T>& array) const;
  void operator%= (const valarray<T>& array) const;
  void operator+= (const valarray<T>& array) const;
  void operator-= (const valarray<T>& array) const;
  void operator^= (const valarray<T>& array) const;
  void operator&= (const valarray<T>& array) const;
  void operator|= (const valarray<T>& array) const;
  void operator<<= (const valarray<T>& array) const;
  void operator>>= (const valarray<T>& array) const;
 
  // fill function
  void operator=(const T&);  

private:
  // constructors
  indirect_array();
  indirect_array(const indirect_array<T>&);
  // operator = 
  indirect_array<T>& 
     operator= (const indirect_array<T>& array);
};

Constructors

indirect_array();
indirect_array(const indirect_array&);

Assignment Operators

void operator=(const valarray<T>& x) const;
indirect_array<T>& 
operator=(const indirect-_array<T>& x);

Computed Assignment Operators

void operator*=(const valarray<T>& val) const;
void operator/=(const valarray<T>& val) const;
void operator%=(const valarray<T>& val) const;
void operator+=(const valarray<T>& val) const;
void operator-=(const valarray<T>& val) const;
void operator^=(const valarray<T>& val) const;
void operator&=(const valarray<T>& val) const;
void operator|=(const valarray<T>& val) const;
void operator<<=(const valarray<T>& val) const;
void operator>>=(const valarray<T>& val) const;

Member Functions

void operator=(const T& x);

Example

Program Output

Warnings

If your compiler does not support namespaces, then you do not need the using declaration for std.

See Also

valarray, slice_array, slice, gslice, gslice_array, mask_array



Previous fileTop of documentContentsIndexNext file
©Copyright 1998, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.
OEM Release, June 1998