valvector_element

View page source

Accessing Elements of a valvector

Returns a reference to the specified element of this valvector.

Prototype

   scalar_type& operator[](size_t j)
   const scalar_type& operator[](size_t j) const

j

This is the index of the element we are accessing.

  1. If the size this valvector is one, j can have any value and the return is the single element in this valvector.

  2. If the size of this valvector is not one, j must be less than its size and the return is the j-th element in this valvector.

Example

The file valvector_element.cpp is an example and test of valvector element access.