本文整理汇总了C++中DVec::pop_back方法的典型用法代码示例。如果您正苦于以下问题:C++ DVec::pop_back方法的具体用法?C++ DVec::pop_back怎么用?C++ DVec::pop_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DVec
的用法示例。
在下文中一共展示了DVec::pop_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeTree
//==================================================================
void MakeTree( TokNode *pRoot, DVec<Token> &tokens, u_int &out_blockCnt )
{
//TokNode *pParent = pRoot;
//DVec<TokNode*> pParentsMemory;
//pParentsMemory.push_back( pParent );
//pPrev = pParent = pParent->AddNewChild( &tokens[i] );
//pParentsMemory.pop_back();
out_blockCnt = 0;
TokNode *pNode = pRoot;
DVec<TokenID> bracketsMemory;
for (size_t i=0; i < tokens.size(); ++i)
{
switch ( tokens[i].id )
{
case RSLC::T_OP_LFT_BRACKET :
case RSLC::T_OP_LFT_CRL_BRACKET :
case RSLC::T_OP_LFT_SQ_BRACKET :
bracketsMemory.push_back( tokens[i].id );
if ( tokens[i].id == RSLC::T_OP_LFT_SQ_BRACKET )
{
pNode->AddNewChild( &tokens[i] );
Token *pNewBrkTok =
DNEW Token(
"(",
RSLC::T_OP_LFT_BRACKET,
RSLC::T_TYPE_OPERATOR,
&tokens[i] );
pNode = pNode->AddNewChild( pNewBrkTok );
//pNode = pNewParent;
}
else
// square bracket is indents itself
//if ( tokens[i].id == RSLC::T_OP_LFT_SQ_BRACKET )
//{
// if NOT( pNode->mpChilds.size() )
// throw Exception( "Misplaced square bracket ?", &tokens[i] );
// pNode = pNode->mpChilds[pNode->mpChilds.size()-1]->AddNewChild( &tokens[i] );
//}
//else
{
pNode = pNode->AddNewChild( &tokens[i] );
}
break;
case RSLC::T_OP_RGT_BRACKET :
case RSLC::T_OP_RGT_CRL_BRACKET :
case RSLC::T_OP_RGT_SQ_BRACKET :
if (!pNode->mpParent ||
!bracketsMemory.size() ||
!doBracketsMatch( bracketsMemory.back(), tokens[i].id ) )
{
throw Exception( "Mismatched brackets ?", &tokens[i] );
}
pNode = pNode->mpParent;
// square bracket is indented itself
//if ( tokens[i].id == RSLC::T_OP_RGT_SQ_BRACKET )
// pNode = pNode->mpParent;
bracketsMemory.pop_back();
break;
default:
pNode->AddNewChild( &tokens[i] );
break;
}
}
defineBlockTypeAndID( pRoot, out_blockCnt );
}