Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2008
Visual Studio
Visual C++
Header Files
<valarray>
<valarray> Classes
valarray Class
valarray Operators
 valarray::operator[]

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
Visual C++ Standard Library
valarray::operator[]

Returns a reference to an element or its value at specified index or a specified subset.

Type& operator[](
   size_t _Off
);
slice_array<Type> operator[](
   slice _Slicearray
);
gslice_array<Type> operator[](
   const gslice& _Gslicearray
);
mask_array<Type> operator[](
   const valarray<bool>& _Boolarray
);
indirect_array<Type> operator[](
   const valarray<size_t>& _Indarray
);
Type operator[](
   size_t _Off
) const;
valarray<Type> operator[](
     slice _Slice 
) const;
valarray<Type> operator[](
   const gslice& _Gslicearray
) const;
valarray<Type> operator[](
   const valarray<bool>& _Boolarray
) const;
valarray<Type> operator[](
   const valarray<size_t>& _Indarray
) const;
_Off

The index of the element to be assigned a value.

_Slicearray

A slice_array of a valarray that specifies a subset to be selected or returned to a new valarray.

_Gslicearray

A gslice_array of a valarray that specifies a subset to be selected or returned to a new valarray.

_Boolarray

A bool_array of a valarray that specifies a subset to be selected or returned to a new valarray.

_Indarray

An indirect_array of a valarray that specifies a subset to be selected or returned to a new valarray.

A reference to an element or its value at specified index or a specified subset.

The member operator is overloaded to provide several ways to select sequences of elements from among those controlled by *this. The first group of five member operators work in conjunction with various overloads of operator= (and other assigning operators) to allow selective replacement (slicing) of the controlled sequence. The selected elements must exist.

When compiling with _SECURE_SCL 1, a runtime error will occur if you attempt to access an element outside the bounds of the valarray. See Checked Iterators for more information.

See the examples for slice::slice and gslice::gslice for an example of how to declare and use the operator.

Header: <valarray>

Namespace: std

Reference

Other Resources

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker