C++
C#
VB
JScript
All

# value_cast

Copyright (C) 2005 IENT-RWTH Aachen

template<class V,class G> inline typename valuecastArray<const Vector<G>,V>::self value_cast(const Vector<G> &X)
template<class V,class G> inline typename valuecastArray<const Matrix<G>,V>::self value_cast(const Matrix<G> &X)

Casts each element

Returns

An array representing the array with casted elements

Example

    DenseVector<float>::self X(3, "1.1 2.2 3.3");
    cout << value_cast<int>(X)[0] << endl; // 1

    DenseVector<int>::self X(4, "1 2 3 4");
    DenseVector<float>::self Y=inv(value_cast<float>(X));

    RGBImage Y(512,512,RGBA(12,54,67));
    cout << value_cast<YUV>(Y)(0,0) << endl;