Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

RWSlice



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

Synopsis

#include <rw/math/mathvec.h>
RWMathVec<double> x(20,2);
RWMathVec<double> y = x("4:9"); // set y to view 
// elements 4 through 9

Description

An RWSlice object is an index which can be used for subscripting vectors, matrices, and arrays. By subscripting with RWSlice 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. To create objects which do not share data, use the copy() or deepenShallowCopy() member functions.

The classes RWRange and RWToEnd are derived from RWSlice. RWRange and RWToEnd objects can be used wherever an RWSlice object can be used.

Although they are not declared, the C++ language automatically defines a copy constructor and an assignment operator. These can be useful when passing RWSlice objects as function arguments or using RWSlice objects as class instance variables.

Example

Program output:

Public Constructors

RWSlice(int begin, int length)
RWSlice(int begin, int length, int stride)
RWSlice(const char *s);

Global Variables

extern RWSlice RWAll;

See Also

RWRange, RWToEnd, and the subscripting operator()() member operators of the vector, matrix, and array classes.



Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.