value_assign.pass.cpp 784 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. // valarray& operator=(const value_type& x);
  12. #include <valarray>
  13. #include <cassert>
  14. int main()
  15. {
  16. {
  17. typedef int T;
  18. T a[] = {1, 2, 3, 4, 5};
  19. const unsigned N = sizeof(a)/sizeof(a[0]);
  20. std::valarray<T> v(a, N);
  21. v = 7;
  22. assert(v.size() == N);
  23. for (int i = 0; i < v.size(); ++i)
  24. assert(v[i] == 7);
  25. }
  26. }