Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 +0000 | [diff] [blame^] | 1 | //===----------------------------------------------------------------------===// |
| 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 | |
| 19 | int 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 | } |