Exemplo n.º 1
0
runall_result test_main()
{
    ArrayViewTest<const int, 1> original(extent<1>(10));
    ArrayViewTest<const int, 1> section = original.section(extent<1>(5));
    
    // set values through the data pointer
    original.set_value(index<1>(4), 13);
    section.set_value(index<1>(3), 15);
    
    return (original.view()(3) == 15 && section.view()(4) == 13) ? original.pass() : original.fail();
}
Exemplo n.º 2
0
int main()
{
    ArrayViewTest<const int, 3> original(extent<3>(2, 3, 4));

    // create a projection
    ArrayViewTest<const int, 2, 3> projection = original.projection(original.view()[1], 1);

    // set some data in the original
    original.set_value(index<3>(1, 1, 2), 13);

    // set some data in the projections
    projection.set_value(index<2>(1, 1), 11);

    // verify each data point through the array_view interface
    return
        original.view()(1, 1, 1) == 11 &&
        projection.view()(1, 2) == 13
        ? original.pass() : original.fail();
}