Home | History | Annotate | Download | only in valarray.assign
      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 
     10 // <valarray>
     11 
     12 // template<class T> class valarray;
     13 
     14 // valarray& operator=(const value_type& x);
     15 
     16 #include <valarray>
     17 #include <cassert>
     18 
     19 int main()
     20 {
     21     {
     22         typedef int T;
     23         T a[] = {1, 2, 3, 4, 5};
     24         const unsigned N = sizeof(a)/sizeof(a[0]);
     25         std::valarray<T> v(a, N);
     26         v = 7;
     27         assert(v.size() == N);
     28         for (int i = 0; i < v.size(); ++i)
     29             assert(v[i] == 7);
     30     }
     31 }
     32