1、rightCols(index n)
example
Array44i a = Array44i::Random();
cout << "Here is the array a:" << endl << a << endl;
cout << "Here is a.rightCols(2):" << endl;
cout << a.rightCols(2) << endl;
a.rightCols(2).setZero();
cout << "Now the array a is:" << endl << a << endl;
output
Here is the array a: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is a.rightCols(2): -5 -3 1 0 0 9 3 9 Now the array a is: 7 9 0 0 -2 -6 0 0 6 -3 0 0 6 6 0 0
2、
template<int N>
rightCols(index n = N)
example
Array44i a = Array44i::Random();
cout << "Here is the array a:" << endl << a << endl;
cout << "Here is a.rightCols<2>():" << endl;
cout << a.rightCols<2>() << endl;
a.rightCols<2>().setZero();
cout << "Now the array a is:" << endl << a << endl;
output
Here is the array a: 7 9 -5 -3 -2 -6 1 0 6 -3 0 9 6 6 3 9 Here is a.rightCols<2>(): -5 -3 1 0 0 9 3 9 Now the array a is: 7 9 0 0 -2 -6 0 0 6 -3 0 0 6 6 0 0