本文整理汇总了C++中var::at方法的典型用法代码示例。如果您正苦于以下问题:C++ var::at方法的具体用法?C++ var::at怎么用?C++ var::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类var
的用法示例。
在下文中一共展示了var::at方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: alloc
var Transpose::alloc(var iVar) const
{
// Allocate an output array
var r;
var s = iVar.shape();
int dim = s.size();
if (dim < 2)
throw error("Transpose::alloc: dimension < 2");
// This is a gotcha: Without the dereference(), s[dim-1] is an lvalue so
// tmp will use the move semantic. This means it will remain a reference;
// this swap is exactly when you don't want it to be one. The other option
// is use get<int>(), which may even be quicker.
var tmp = s[dim-1].dereference();
s[dim-1] = s[dim-2];
s[dim-2] = tmp;
r = view(s, iVar.at(0));
return r;
}