blob: 936c3c037a6743a1b8b2f49667c01134c9afa28b [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
3// ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊThe LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <valarray>
11
12// template<class T> class valarray;
13
14// value_type& operator[](size_t i);
15
16#include <valarray>
17#include <cassert>
18
19int main()
20{
21 {
22 typedef int T;
23 T a[] = {5, 4, 3, 2, 1};
24 const unsigned N = sizeof(a)/sizeof(a[0]);
25 std::valarray<T> v(a, N);
26 for (int i = 0; i < N; ++i)
27 {
28 assert(v[i] == a[i]);
29 v[i] = i;
30 assert(v[i] == i);
31 }
32 }
33}