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 // explicit valarray(size_t); 15 16 #include <valarray> 17 #include <cassert> 18 main()19int main() 20 { 21 { 22 std::valarray<int> v(100); 23 assert(v.size() == 100); 24 for (int i = 0; i < 100; ++i) 25 assert(v[i] == 0); 26 } 27 { 28 std::valarray<double> v(100); 29 assert(v.size() == 100); 30 for (int i = 0; i < 100; ++i) 31 assert(v[i] == 0); 32 } 33 { 34 std::valarray<std::valarray<double> > v(100); 35 assert(v.size() == 100); 36 for (int i = 0; i < 100; ++i) 37 assert(v[i].size() == 0); 38 } 39 } 40