本文整理汇总了C++中Flow::Counter方法的典型用法代码示例。如果您正苦于以下问题:C++ Flow::Counter方法的具体用法?C++ Flow::Counter怎么用?C++ Flow::Counter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flow
的用法示例。
在下文中一共展示了Flow::Counter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PickTwoColours
void Colour_Generator::PickTwoColours(const size_t & beam,int * cols) {
Flow flow;
size_t index;
cols[0] = cols[1] = -1;
for (index=0;index<2;index++) {
if (m_col[beam][index].size()==0) cols[index] = flow.Counter();
else {
cols[index] = (*m_col[beam][index].begin());
}
}
if (cols[0]==cols[1]) {
if (m_col[beam][0].size()==1 && m_col[beam][1].size()==1) {
cols[ran->Get()>0.5?0:1] = flow.Counter();
}
else {
index = m_col[beam][0].size()>m_col[beam][1].size()?0:1;
set<int>::iterator cit=m_col[beam][index].begin();
cit++;
cols[index] = (*cit);
m_col[beam][index].erase(cols[index]);
}
}
for (index=0;index<2;index++) {
if (cols[index]==(*m_col[beam][1-index].begin())) {
m_col[beam][1-index].erase(cols[index]);
}
}
msg_Tracking()<<METHOD<<" yields "<<cols[0]<<" "<<cols[1]<<".\n";
}
示例2: col
int Colour_Generator::
PickColourPair(const size_t & beam,const size_t & index) {
msg_Tracking()<<METHOD<<"(beam = "<<beam<<", index = "<<index<<"): "
<<m_col[beam][index].size()<<" "<<m_col[1-beam][1-index].size();
int col(-1);
for (set<int>::iterator cit1=m_col[beam][index].begin();
cit1!=m_col[beam][index].end();cit1++) {
for (set<int>::iterator cit2=m_col[1-beam][1-index].begin();
cit2!=m_col[1-beam][1-index].end();cit2++) {
if ((*cit1)==(*cit2)) {
col = (*cit1);
m_col[beam][index].erase(col);
m_col[1-beam][1-index].erase(col);
break;
}
}
if (col!=-1) break;
}
if (col==-1) {
Flow Flow;
col = Flow.Counter();
m_col[beam][1-index].insert(col);
m_col[1-beam][index].insert(col);
}
msg_Tracking()<<" ---> "<<col<<".\n";
return col;
}