#include #include using namespace StormEigen; using namespace std; template StormEigen::VectorBlock firstTwo(MatrixBase& v) { return StormEigen::VectorBlock(v.derived(), 0); } template const StormEigen::VectorBlock firstTwo(const MatrixBase& v) { return StormEigen::VectorBlock(v.derived(), 0); } int main(int, char**) { Matrix v; v << 1,2,3,4,5,6; cout << firstTwo(4*v) << endl; // calls the const version firstTwo(v) *= 2; // calls the non-const version cout << "Now the vector v is:" << endl << v << endl; return 0; }