SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

Represents an index that can be used for subscripting vectors, matrices, and arrays from a given element to the end. More...

#include <rw/rwslice.h>

Inheritance diagram for RWToEnd:
RWSlice

Public Member Functions

 RWToEnd (int begin)
 
 RWToEnd (int begin, int stride)
 
- Public Member Functions inherited from RWSlice
 RWSlice (const char *s)
 
 RWSlice (int begin, int length)
 
 RWSlice (int begin, int length, int stride)
 

Additional Inherited Members

Detailed Description

An RWToEnd object is an index which can be used for subscripting vectors, matrices, and arrays from a given element to the end. By subscripting with RWToEnd objects, you create views of selected elements. These new views are vectors, matrices, or arrays in their own right, rather than simply helper classes. This means that a view created with subscripting can be used as an rvalue, an lvalue, or kept as an object for use later.

The class RWToEnd is derived from RWSlice. It can be used to initialize an RWSlice object as follows:

Represents an index that can be used for subscripting vectors, matrices, and arrays.
Definition rwslice.h:105
Represents an index that can be used for subscripting vectors, matrices, and arrays from a given elem...
Definition rwslice.h:313
Synopsis
#include <rw/math/mathvec.h>
cout << x(RWToEnd(4)); // output elements 4 to last
A templatized vector class.
Definition mathvec.h:667
Example
#include <rw/math/genmat.h>
#include <iostream.h>
int main() {
RWGenMat<int> A(6, 6);
A = 0;
RWToEnd I(3); // indices 3,4,5
A(I, I) = 1;
cout << A << endl;
}
A templatized general matrix class.
Definition genmat.h:741

Program output:

6x6
[
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 1 1 1
0 0 0 1 1 1
0 0 0 1 1 1
]
See also
RWRange, RWSlice, RWMathVec::operator()(), RWGenMat::operator()(), RWMathArray::operator()()

Constructor & Destructor Documentation

◆ RWToEnd() [1/2]

RWToEnd::RWToEnd ( int begin)
inline

Constructs an object which indexes starting at element begin and ending with the last element.

◆ RWToEnd() [2/2]

RWToEnd::RWToEnd ( int begin,
int stride )
inline

Constructs an object which indexes starting at element begin and ending with the last element. The parameter stride is the increment between successive selected elements.

Copyright © 2024 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.