本文整理汇总了C++中HT::cbegin方法的典型用法代码示例。如果您正苦于以下问题:C++ HT::cbegin方法的具体用法?C++ HT::cbegin怎么用?C++ HT::cbegin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HT
的用法示例。
在下文中一共展示了HT::cbegin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: excl
//***********************************************************************
int excl(HT& leftExp, const HT& rightExp)
{
int stPos = -1, curPos = -1, step = 0;
if (!rightExp.empty() && !leftExp.empty()) {
if (leftExp.size() < rightExp.size())
return 1;
int sizeL = leftExp.size();
int sizeR = rightExp.size();
for (int i = 0; i < sizeL && (curPos - stPos + 1) != sizeR; ++i) {
for (HT::const_iterator itL = leftExp.cbegin(); itL != leftExp.cend(); ++itL)
if (itL->second == i) {
if (stPos == -1) {
HT::const_iterator itR = rightExp.cbegin();
for (; itR != rightExp.cend() && itR->second != 0; ++itR);
if (itR->first == itL->first)
curPos = stPos = itL->second;
}
else
for (HT::const_iterator itR = rightExp.cbegin(); itR != rightExp.cend(); ++itR)
if (itR->first == itL->first) {
if (itL->second > curPos && itL->second - curPos == 1) {
curPos = itL->second;
}
}
if ((curPos - stPos +1) == sizeR)
break;
if (curPos != itL->second)
stPos = -1;
}
}
if(stPos!=-1)
erase(leftExp, stPos, stPos + rightExp.size()-1);
else return 1;
}
return 0;
}
示例2: concat
//***********************************************************************
void concat(HT& leftExp, const HT &rightExp)
{
if (!rightExp.empty()) {
int newPos = leftExp.size();
int s = rightExp.size();
for (int i = 0; i < s; ++i) {
for (HT::const_iterator it = rightExp.cbegin(); it != rightExp.cend(); ++it)
if (it->second == i) {
leftExp.insert(HT::value_type((*it).first, newPos++));
break;
}
}
}
}
示例3: getInf
void getInf(const HT& T, char name)
{
if (!T.empty()) {
unsigned n = T.bucket_count();
for (unsigned i = 0; i<n; ++i) {
cout << "A[" << i << "]: ";
for (auto it = T.cbegin(i); it != T.cend(i); ++it)
cout << "{" << it->first << ":" << it->second << "} ";
cout << "\n";
}
}
else
cout << "Хеш-таблица " << name << " пустая";
cout << endl;
}
示例4: getInfSeq
//***********************************************************************
void getInfSeq(const HT& T, char name)
{
if (!T.empty()) {
cout << name << " = <";
int s = T.size();
for (int i = 0; i < s; ++i) {
for (HT::const_iterator it = T.cbegin(); it != T.cend(); ++it)
if (it->second == i) {
cout << it->first << ' ';
break;
}
}
cout << "\b>" << endl;
}
else
cout << name << " - Пустая последовательность!"<<endl;
}