C++
C#
VB
JScript
All

External Function first


Copyright (C) 2005 IENT-RWTH Aachen

template<class G> inline typename firstComponentArray <      Vector<G> >::self first (      Vector<G> &X)
template<class G> inline typename firstComponentArray <const Vector<G> >::self first (const Vector<G> &X)
template<class G> inline typename firstComponentArray <      Matrix<G> >::self first (      Matrix<G> &X)
template<class G> inline typename firstComponentArray <const Matrix<G> >::self first (const Matrix<G> &X)
template<class T1,class T2,class T3> inline T1       &first (      ColorSpace<T1,T2,T3> &x)
template<class T1,class T2,class T3> inline const T1 &first (const ColorSpace<T1,T2,T3> &x)

First part (element-wise)

Returns

An array representing the first part of X

Remarks

This function supposes the existence of a function first applicable on each element. A function first is defined for color spaces of the library and for the STL pair structur. The function first has to be overloaded for any other classes, and should give a reference back, if a use as left-value is expected.

Example

DenseVector<pair<int,int> >::self X(3);
X[0]=pair<int,float>(1,2); X[0]=pair<int,float>(3,4); X[2]=pair<int,float>(5,6);
cout << first(X) << endl; // [1 3 5]
first(X) = 0;
cout << first(X) << endl; // [0 0 0]

RGBImage X;
PPMFile fin("x.ppm");
fin >> X; // load a RGB image from a PPM file
ucharImage Y = first(value_cast<YUV>(X)); // Greyscale image of X

See Also

second, third