// [doc-example-start] // take any dynamic matrix as input parameter // Const or not, Reference or not template void FunctionDynamicA(vctDynamicConstMatrixBase<_matrixOwnerType, _elementType> & matrix) { std::cout << matrix << std::endl; } // take any non-const matrix as input parameter, Reference or not template void FunctionDynamicB(vctDynamicMatrixBase<_matrixOwnerType, _elementType> & matrix) { matrix.setsize(10, 10); } // only take a matrix as input parameter, can't use a Reference template void FunctionDynamicC(vctDynamicMatrix<_elementType> & matrix) { matrix.resize(10, 10); } // this shows how to restrict to a given type of elements (double) template void FunctionDynamicD(vctDynamicConstMatrixBase<_matrixOwnerType, double> & matrix) { std::cout << matrix << std::endl; } // take any two dynamic matrices as input parameters // Const or not, Reference or not, same type of elements template void FunctionDynamicE(vctDynamicConstMatrixBase<_matrixOwnerType1, _elementType> & matrix1, vctDynamicConstMatrixBase<_matrixOwnerType2, _elementType> & matrix2) { // this will throw an exception if the matrices don't have the correct sizes std::cout << matrix1 * matrix2 << std::endl; } // function with a return type template vctReturnDynamicVector<_elementType> FunctionDynamicF(const vctDynamicConstVectorBase<_vectorOwnerType, _elementType> & inputVector) { typedef _elementType value_type; vctDynamicVector resultStorage(inputVector.size()); // ...... do something to resultStorage return vctReturnDynamicVector(resultStorage); } // [doc-example-end]