Prev Next

@(@\newcommand{\B}[1]{ {\bf #1} } \newcommand{\R}[1]{ {\rm #1} }@)@
Setting and Getting Vector Elements

Syntax
u[i] = x
y = v[i]

element_type
We use element_type to denote the type of elements in the vector. It must be one of the following types: bool, int, double, a_double.

i
This argument has prototype
     size_t 
i
It must be between zero and the size of the vector minus one.

u
The object u has prototype
     vec_
element_type&   u

x
The argument x has prototype
     const 
element_typex

v
The object v has the following prototype
     const vec_
element_typev

y
The result y has prototype
     
element_type y

Octave
Note that Octave uses parenthesis () instead of brackets [] for element access.

Perl
Note that Perl does not support the element syntax above and instead uses set and get member functions.

Example
C++ , Octave , Perl , Python .
Input File: lib/vector.omh