本文整理汇总了C++中std::stack::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ stack::empty方法的具体用法?C++ stack::empty怎么用?C++ stack::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::stack
的用法示例。
在下文中一共展示了stack::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wmsPopNotifyFlags
void wmsPopNotifyFlags()
{
if(theNotifyFlagsStack.empty())
{
return;
}
theNotifyFlags = theNotifyFlagsStack.top();
theNotifyFlagsStack.pop();
}
示例2: PopExpListValueCount
int PopExpListValueCount()
{
if (exp_list_value_count_.empty())
return 0;
int result = exp_list_value_count_.top();
exp_list_value_count_.pop();
return result;
}
示例3: reset
void reset()
{
while(!VIEWSTACK.empty()) {
VIEWSTACK.pop();
}
WORLDVIEW = new ViewBox(W,H,0,0);
VIEWSTACK.push(*WORLDVIEW);
}
示例4: convertStackToContainer
container convertStackToContainer(std::stack<uint32_t>& stack) {
container result;
do {
result.push_back(stack.top());
stack.pop();
} while(not stack.empty());
std::reverse(result.begin(), result.end());
return result;
}
示例5: update
bool CameraManager::update(float dt)
{
static std::stack<int> precedingBehaviors;
if ( dt == 0 ) return false;
mTransScale = mTransSpeed * dt;
mRotScale = mRotateSpeed * dt;
ctx.mCurrTruck = BeamFactory::getSingleton().getCurrentTruck();
ctx.mDt = dt;
ctx.mRotScale = Degree(mRotScale);
ctx.mTransScale = mTransScale;
ctx.fovInternal = Degree(FSETTING("FOV Internal", 75.0f));
ctx.fovExternal = Degree(FSETTING("FOV External", 60.0f));
if ( currentBehaviorID < CAMERA_BEHAVIOR_END && INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_CHANGE) )
{
switchToNextBehavior(false);
}
if ( INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_FREE_MODE_FIX) )
{
toggleBehavior(CAMERA_BEHAVIOR_FIXED);
}
if ( INPUTENGINE.getEventBoolValueBounce(EV_CAMERA_FREE_MODE) )
{
toggleBehavior(CAMERA_BEHAVIOR_FREE);
}
if ( !ctx.mCurrTruck && hasActiveVehicleBehavior() )
{
precedingBehaviors.push(currentBehaviorID);
switchBehavior(CAMERA_BEHAVIOR_CHARACTER);
} else if ( ctx.mCurrTruck && hasActiveCharacterBehavior() )
{
if ( !precedingBehaviors.empty() )
{
switchBehavior(precedingBehaviors.top(), false);
precedingBehaviors.pop();
} else
{
switchBehavior(CAMERA_BEHAVIOR_VEHICLE);
}
}
if ( currentBehavior )
{
currentBehavior->update(ctx);
} else
{
switchBehavior(CAMERA_BEHAVIOR_CHARACTER);
}
return true;
}
示例6: glScissorPop
void glScissorPop()
{
if(!scissorStack.empty())
{
Recti scissor = scissorStack.top();
scissorStack.pop();
glScissor(scissor.min[0], scissor.min[1], scissor.max[0] - scissor.min[0] + 1, scissor.max[1] - scissor.min[1] + 1);
}
}
示例7: pop
void pop() {
if (s.empty()) {
return;
}
if (min.top() == s.top()) {
min.pop();
}
s.pop();
}
示例8: PrintStack
void PrintStack(std::stack<int> stackIn)
{
while(!stackIn.empty())
{
std::cout << stackIn.top() << " ";
stackIn.pop();
}
std::cout << "\n";
}
示例9: catch_point
jmp_buf* catch_point()
{
if ( catch_points.empty() ) {
fprintf(stderr, "Fatal internal error: Exception stack underflow\n");
exit(1);
}
return catch_points.top();
}
示例10: printstack
void printstack(std::stack<frac*> s )
{
std::cout<<"stack:"<<std::endl;
while(!s.empty())
{
s.top()->display();
s.pop();
}
}
示例11: toIndexPath
// Note: empties the passed stack
std::vector<int> toIndexPath(std::stack<maze_point> path, int mazeSize) {
std::vector<int> indexPath;
indexPath.reserve(path.size());
while (!path.empty()) {
indexPath.push_back(path.top().position.getIndex(mazeSize));
path.pop();
}
return indexPath;
}
示例12: reverse_stack
void reverse_stack(std::stack<T>& st)
{
if(!st.empty())
{
T top = st.top();
st.pop();
reverse_stack(st);
add_to_stack_bottom(st, top);
}
}
示例13: ReverseStack
void ReverseStack(std::stack<int>& stack)
{
if (!stack.empty() )
{
int top = stack.top();
stack.pop();
ReverseStack(stack);
addtobottom(stack,top);
}
}
示例14: pop
void pop()
{
if (elements.empty()) {
return;
}
if (elements.top() == mins.top()) {
mins.pop();
}
elements.pop();
}
示例15:
template<typename T> void Add_Bottom(std::stack<T>& stk, T val) {
if(stk.empty())
stk.push(val);
else {
T t = stk.top();
stk.pop();
Add_Bottom(stk, val);
stk.push(t);
}
}