TemplateKeyword_flexible.cpp
Go to the documentation of this file.
1 #include <Eigen/Dense>
2 #include <iostream>
3 
4 template <typename Derived1, typename Derived2>
6 {
7  /* Note the 'template' keywords in the following line! */
8  dst.template triangularView<Eigen::Upper>() = src.template triangularView<Eigen::Upper>();
9 }
10 
11 int main()
12 {
15  std::cout << "m2 before copy:" << std::endl;
16  std::cout << m2 << std::endl << std::endl;
17  copyUpperTriangularPart(m2, m1.topLeftCorner(4,4));
18  std::cout << "m2 after copy:" << std::endl;
19  std::cout << m2 << std::endl << std::endl;
20 }
Matrix3d m1
Definition: IOFormat.cpp:2
void copyUpperTriangularPart(Eigen::MatrixBase< Derived1 > &dst, const Eigen::MatrixBase< Derived2 > &src)
MatrixType m2(n_dims)
static const ConstantReturnType Ones()
static const RandomReturnType Random()
Definition: Random.h:114
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182