本文整理汇总了C++中LList::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::IsEmpty方法的具体用法?C++ LList::IsEmpty怎么用?C++ LList::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::IsEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoBFS
void DoBFS()
{
// By default, starts at goal state
SlidingPuzzleState s;
LList<int> moves;
uint8_t *stateDepths = new uint8_t[s.GetMaxRank()];
// set all values to 255
memset(stateDepths, 255, s.GetMaxRank());
uint32_t seenStates = 1;
stateDepths[s.Rank()] = 0;
int currDepth = 0;
Timer fullTimer;
std::cout.setf( std::ios::fixed, std:: ios::floatfield ); // floatfield set to fixed
std::cout.precision(2);
while (seenStates != s.GetMaxRank())
{
Timer roundTimer;
for (int x = 0; x < s.GetMaxRank(); x++)
{
if (stateDepths[x] == currDepth)
{
s.Unrank(x);
s.GetMoves(moves);
while (moves.IsEmpty() == false)
{
s.ApplyMove(moves.PeekFront());
uint32_t rank = s.Rank();
s.UndoMove(moves.PeekFront());
moves.RemoveFront();
if (stateDepths[rank] == 255)
{
stateDepths[rank] = currDepth+1;
seenStates++;
}
}
}
}
std::cout << roundTimer.GetElapsedTime() << "s elapsed. ";
std::cout << "Depth " << currDepth;
std::cout << " complete. " << seenStates << " of " << s.GetMaxRank();
std::cout << " total states seen.\n";
currDepth++;
}
std::cout << fullTimer.EndTimer() << "s elapsed\n";
delete [] stateDepths;
}