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