end_const.pass.cpp 780 B

12345678910111213141516171819202122232425262728293031
  1. //===----------------------------------------------------------------------===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is dual licensed under the MIT and the University of Illinois Open
  6. // Source Licenses. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. // <valarray>
  10. // template<class T> class valarray;
  11. // template <class T>
  12. // unspecified1
  13. // end(const valarray<T>& v);
  14. #include <valarray>
  15. #include <cassert>
  16. int main()
  17. {
  18. {
  19. typedef int T;
  20. T a[] = {1, 2, 3, 4, 5};
  21. const unsigned N = sizeof(a)/sizeof(a[0]);
  22. const std::valarray<T> v(a, N);
  23. assert(v[v.size()-1] == 5);
  24. assert(end(v) - begin(v) == v.size());
  25. }
  26. }