index::operator[] 运算符

返回指定位置的索引组件。

int operator[] (
   unsigned _Index
) const restrict(amp,cpu);

int& operator[] (
   unsigned _Index
) restrict(amp,cpu);

参数

  • _Index
    从 0 到负 1 级别的整数。

返回值

指定索引处的元素。

备注

此以下示例显示了索引的分量值。

// Prints 1 2 3.
concurrency::index<3> idx(1, 2, 3);
std::cout << idx[0] << "\n";
std::cout << idx[1] << "\n";
std::cout << idx[2] << "\n";

要求

**标头:**amp.h

命名空间: 并发

请参见

参考

index 类