• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <valarray>
10 
11 // template<class T> class valarray;
12 
13 // template <class T>
14 //   unspecified1
15 //   end(valarray<T>& v);
16 
17 #include <valarray>
18 #include <cassert>
19 #include <cstddef>
20 
21 #include "test_macros.h"
22 
main(int,char **)23 int main(int, char**)
24 {
25     {
26         typedef int T;
27         T a[] = {1, 2, 3, 4, 5};
28         const unsigned N = sizeof(a)/sizeof(a[0]);
29         std::valarray<T> v(a, N);
30         *(end(v) - 1) = 10;
31         assert(v[v.size()-1] == 10);
32         assert(static_cast<std::size_t>(end(v) - begin(v)) == v.size());
33     }
34 
35   return 0;
36 }
37