1 | #include <iostream> |
2 | #include <valarray> |
3 | |
4 | int main() { |
5 | |
6 | std::valarray<int> va_int(4); |
7 | std::cout << "break here" ; |
8 | |
9 | va_int[0] = 1; |
10 | va_int[1] = 12; |
11 | va_int[2] = 123; |
12 | va_int[3] = 1234; |
13 | |
14 | std::valarray<double> va_double({1.0, 0.5, 0.25, 0.125}); |
15 | |
16 | std::valarray<int> va({10, 11, 12, 13, 14, 15, 16, 17, 18, 19}); |
17 | std::slice_array<int> sa = va[std::slice(1, 4, 2)]; |
18 | std::gslice_array<int> ga = va[std::gslice( |
19 | 3, std::valarray<std::size_t>(3, 1), std::valarray<std::size_t>(1, 1))]; |
20 | std::mask_array<int> ma = va[std::valarray<bool>{false, true, true}]; |
21 | std::indirect_array<int> ia = va[std::valarray<size_t>{3, 6, 9}]; |
22 | |
23 | std::cout << "break here\n" ; |
24 | } |
25 | |