SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches
RWMathVecPick< T > Class Template Reference

Allows selected elements to be addressed in a vector, without creating a new view. More...

#include <rw/math/mthvecpk.h>

Public Member Functions

RWMathVec< T >::size_type length () const
 
T & operator() (int i)
 
operator() (int i) const
 
RWMathVecPick< T > & operator= (const RWMathVecPick< T > &)
 

Friends

class RWMathVec< T >
 

Detailed Description

template<class T>
class RWMathVecPick< T >

The RWMathVecPick class allows selected elements to be addressed. Unlike subscripting or slicing, picking does not create a new view.

Example
#include <rw/math/mathvec.h>
#include <iostream>
int main() {
// Set up picked elements:
RWIntVec ipick("[3 4 8]");
RWMathVec<double> dv(10, 0, 2); // 0 2 4 6 8 10 12 14 16 18
RWMathVecPick<double> dvPick = dv.pick(ipick);
std::cout << dvPick.length() << std::endl; // 3
std::cout << dvPick(0) << std::endl; // 6
std::cout << dvPick(2) << std::endl; // 16
return 0;
}
Allows selected elements to be addressed in a vector, without creating a new view.
Definition mthvecpk.h:53
RWMathVec< T >::size_type length() const
Definition mthvecpk.h:99

Member Function Documentation

◆ length()

template<class T >
RWMathVec< T >::size_type RWMathVecPick< T >::length ( ) const
inline

Return the number of elements in the pick

◆ operator()() [1/2]

template<class T >
T & RWMathVecPick< T >::operator() ( int i)
inline

Returns a reference to the value in the associated RWMathVec stored at the index indicated by the i th element of the RWMathVecPick.

◆ operator()() [2/2]

template<class T >
T RWMathVecPick< T >::operator() ( int i) const
inline

Returns the value in the associated RWMathVec stored at the index indicated by the i th element of the RWMathVecPick.

◆ operator=()

template<class T >
RWMathVecPick< T > & RWMathVecPick< T >::operator= ( const RWMathVecPick< T > & )

Assignment operator for RWMathVecPick. The picks must have the same dimensions. The expression:

this = v;

implies thisi = vi

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