slice (); slice (size_t start, size_t length, size_t stride); slice (const slice& slc);
slice constructor
// slice::slice example #include <iostream> #include <valarray> using namespace std; int main () { valarray<int> foo (12); for (int i=0; i<12; ++i) foo[i]=i; slice first; slice second (2,3,4); slice third (second); valarray<int> bar = foo[third]; for (size_t n=0; n<bar.size(); n++) cout << bar[n] << ' '; cout << endl; return 0; }
2 6 10