C++/Valarray/valarray indexer
Use subscript to assign value to valarray
#include <iostream>
#include <valarray>
#include <cmath>
using namespace std;
int main()
{
valarray<int> v(10);
int i;
for(i=0; i<10; i++) v[i] = i;
cout << "Original contents: ";
for(i=0; i<10; i++)
cout << v[i] << " ";
cout << endl;
}
/*
Original contents: 0 1 2 3 4 5 6 7 8 9
*/