1bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
2bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
3f5256e16dfc425c1d466f6308d4026d529ce9e0bHoward Hinnant//                     The LLVM Compiler Infrastructure
4bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
5b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// This file is dual licensed under the MIT and the University of Illinois Open
6b64f8b07c104c6cc986570ac8ee0ed16a9f23976Howard Hinnant// Source Licenses. See LICENSE.TXT for details.
7bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//
8bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant//===----------------------------------------------------------------------===//
9bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
10bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// <valarray>
11bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
12bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// template <class T> class gslice_array
13bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
14bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant// void operator^= (const valarray<value_type>& v) const;
15bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
16bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <valarray>
17bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant#include <cassert>
18bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant
19bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnantint main()
20bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant{
21bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int a1[] = { 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
22bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
23bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
24bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                36, 37, 38, 39, 40};
25bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    int a2[] = {  1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11, 12,
26bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                 13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23, 24};
27bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
28bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::valarray<int> v2(a2, sizeof(a2)/sizeof(a2[0]));
29bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::size_t sz[] = {2, 4, 3};
30bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    std::size_t st[] = {19, 4, 1};
31bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    typedef std::valarray<std::size_t> sizes;
32bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    typedef std::valarray<std::size_t> strides;
33bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    v1[std::gslice(3, sizes(sz, sizeof(sz)/sizeof(sz[0])),
34bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant                      strides(st, sizeof(st)/sizeof(st[0])))] ^= v2;
35bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1.size() == 41);
36bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 0] ==  0);
37bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 1] ==  1);
38bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 2] ==  2);
39bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 3] ==  2);
40bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 4] ==  6);
41bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 5] ==  6);
42bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 6] ==  6);
43bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 7] ==  3);
44bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 8] == 13);
45bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[ 9] == 15);
46bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[10] == 10);
47bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[11] == 12);
48bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[12] ==  4);
49bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[13] ==  4);
50bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[14] == 14);
51bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[15] ==  5);
52bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[16] == 27);
53bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[17] == 29);
54bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[18] == 18);
55bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[19] == 19);
56bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[20] == 20);
57bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[21] == 21);
58bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[22] == 27);
59bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[23] == 25);
60bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[24] == 23);
61bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[25] == 25);
62bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[26] == 10);
63bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[27] == 10);
64bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[28] == 14);
65bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[29] == 29);
66bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[30] == 13);
67bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[31] == 11);
68bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[32] == 53);
69bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[33] == 33);
70bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[34] == 52);
71bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[35] == 52);
72bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[36] == 60);
73bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[37] == 37);
74bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[38] == 38);
75bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[39] == 39);
76bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant    assert(v1[40] == 40);
77bc8d3f97eb5c958007f2713238472e0c1c8fe02Howard Hinnant}
78