copy 函数

复制 C++ AMP 对象。 所有同步数据传输要求都得到满足。 当在加速器上运行代码时,您无法复制数据。 此功能的一般形式为 copy(src, dest)。

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array<_Value_type, _Rank>& _Src,
   array<_Value_type, _Rank>& _Dest
);

template <
   typename InputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   InputIterator _SrcFirst,
   InputIterator _SrcLast,
   array<_Value_type, _Rank> &_Dest
);

template <
   typename InputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   InputIterator _SrcFirst,
   array<_Value_type, _Rank> &_Dest
);

template <
   typename OutputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   const array<_Value_type, _Rank> &_Src,
   OutputIterator _DestIter
);

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array<_Value_type, _Rank>& _Src,
   array_view<_Value_type, _Rank>& _Dest
);

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array_view<const _Value_type, _Rank>& _Src,
   array<_Value_type, _Rank>& _Dest
);

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array_view<_Value_type, _Rank>& _Src,
   array<_Value_type, _Rank>& _Dest
);

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array_view<const _Value_type, _Rank>& _Src,
   array_view<_Value_type, _Rank>& _Dest
);

template <
   typename _Value_type,
   int _Rank
>
void copy(
   const array_view<_Value_type, _Rank>& _Src,
   array_view<_Value_type, _Rank>& _Dest
);

template <
   typename InputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   InputIterator _SrcFirst,
   InputIterator _SrcLast,
   array_view<_Value_type, _Rank> &_Dest
);

template <
   typename InputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   InputIterator _SrcFirst,
   array_view<_Value_type, _Rank> &_Dest
);

template <
   typename OutputIterator,
   typename _Value_type,
   int _Rank
>
void copy(
   const array_view<_Value_type, _Rank> &_Src,
   OutputIterator _DestIter
);

参数

  • _Dest
    要复制到的对象。

  • _DestIter
    在目标中对于开始位置的输出迭代器。

  • InputIterator
    输入迭代器的类型。

  • OutputIterator
    输出迭代器的类型。

  • _Rank
    要复制的对象或复制到的对象的等级。

  • _Src
    要复制到的对象。

  • _SrcFirst
    进入源容器的开始迭代器。

  • _SrcLast
    进入源容器的结束迭代器。

  • _Value_type
    已复制的元素的日期类型。

备注

复制操作总是执行深层复制。

如果源和定义对象的范围不匹配,将引发 runtime_exception

您可从以下源复制到 数组array_view 对象:

  • 与目标 arrayarray_view 具有相同的秩和元素类型的 arrayarray_view

  • 元素类型与为目标 arrayarray_view 相同的标准容器。 公开 size()data() 成员的容器能更高效地执行。

要求

**标头:**amp.h

命名空间: 并发

请参见

参考

Concurrency 命名空间 (C++ AMP)