C++ 如何使用xt::repeat?

C++ 如何使用xt::repeat?,c++,xtensor,C++,Xtensor,我想以与numpy相同的方式获取重复数组,但xt::repeat返回表达式。当我试图将这个表达式转换为数组时,我得到了编译错误 xt::array<int> a = {{1, 2}, {3, 4}}; auto r = xt::repeat(a, 3, 1); // r is expression xt::array<int> b = r; // compile error here 数组a={{1,2},{3,4}; 自动r=xt::重复(a,3,1);//r是表达式

我想以与
numpy
相同的方式获取重复数组,但
xt::repeat
返回表达式。当我试图将这个表达式转换为数组时,我得到了编译错误

xt::array<int> a = {{1, 2}, {3, 4}};
auto r = xt::repeat(a, 3, 1); // r is expression
xt::array<int> b = r; // compile error here
数组a={{1,2},{3,4}; 自动r=xt::重复(a,3,1);//r是表达式 xt::数组b=r;//此处编译错误
如何重复数组并将结果作为另一个数组而不是表达式?也许我在文档中遗漏了一些东西,但我找不到工作示例。

这是
xtensor中的一个错误。我正在开发修补程序,现在您可以使用以下解决方法:

xt::xarray<int> b(r.shape());
std::copy(r.cbegin(), r.cend(), b.begin());
xt::xarray b(r.shape());
复制(r.cbegin(),r.cend(),b.begin());

我很确定这是一个bug:@TomdeGeus请在这个bug被解决的时候发布答案。看起来它在版本中解决了,带有PR