本文整理汇总了C++中Array::GetField方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::GetField方法的具体用法?C++ Array::GetField怎么用?C++ Array::GetField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::GetField方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BitSequenceOneLevelRank
PermutationMRRR::PermutationMRRR(Array *perm, cds_word rate) {
this->permutation_ = perm;
Array *visited = Array::Create(perm->GetLength(), 1);
visited->Use();
Array *sampled = Array::Create(perm->GetLength(), 1);
sampled->Use();
vector<cds_word> sampled_values;
for (cds_word i = 0; i < perm->GetLength(); i++) {
if (visited->GetField(i)) continue;
bool added = false;
cds_word last = i;
visited->SetField(i, 1);
cds_word pos = perm->GetField(i);
cds_word count = 1;
while (pos != i) {
visited->SetField(pos, 1);
if (count == rate) {
added = true;
sampled_values.push_back(last);
sampled->SetField(pos, 1);
last = pos;
count = 0;
}
pos = perm->GetField(pos);
count++;
}
if (added) {
sampled->SetField(pos, 1);
sampled_values.push_back(last);
}
}
sampled_ = new BitSequenceOneLevelRank(sampled, 20);
sampled_->Use();
rev_links_ = Array::Create(sampled_values);
rev_links_->Use();
visited->Unuse();
sampled->Unuse();
}