本文整理汇总了C++中TStack::size方法的典型用法代码示例。如果您正苦于以下问题:C++ TStack::size方法的具体用法?C++ TStack::size怎么用?C++ TStack::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TStack
的用法示例。
在下文中一共展示了TStack::size方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Expand
void CStackTraceImpl::Expand(CStackTrace::TStack& stack)
{
char** syms = backtrace_symbols(&m_Stack[0], m_Stack.size());
for (size_t i = 0; i < m_Stack.size(); ++i) {
string sym = syms[i];
CStackTrace::SStackFrameInfo info;
info.func = sym.empty() ? "???" : sym;
info.file = "???";
info.offs = 0;
info.line = 0;
string::size_type pos = sym.find_first_of("(");
if (pos != string::npos) {
info.module = sym.substr(0, pos);
sym.erase(0, pos + 1);
}
pos = sym.find_first_of(")");
if (pos != string::npos) {
sym.erase(pos);
pos = sym.find_last_of("+");
if (pos != string::npos) {
string sub = sym.substr(pos + 1, sym.length() - pos);
info.func = sym.substr(0, pos);
info.offs = NStr::StringToInt(sub, 0, 16);
}
}
//
// name demangling
//
if ( !info.func.empty() && info.func[0] == '_') {
#if NCBI_COMPILER_VERSION >= 310
// use abi::__cxa_demangle
size_t len = 0;
char* buf = 0;
int status = 0;
buf = abi::__cxa_demangle(info.func.c_str(),
buf, &len, &status);
if ( !status ) {
info.func = buf;
free(buf);
}
#endif
}
stack.push_back(info);
}
free(syms);
}
示例2: mul
//умножение
void mul()
{
if(Data.size()>1)
{
double x = Data.pop();
double y = Data.pop();
Data.push(x*y);
it++;
}
else error("cann't execute mul, stack is empty");
}
示例3: sub
//разность
void sub()
{
if(Data.size()>1)
{
double y = Data.pop();
double x = Data.pop();
Data.push(x-y);
it++;
}
else error("cann't execute add, stack is empty");
}
示例4: div
//деление
void div()
{
if(Data.size()>1)
{
double y = Data.pop();
double x = Data.pop();
if(y) Data.push(x/y);
else error("devide by zero");
it++;
}
else error("cann't execute add, stack is empty");
}
示例5: Count
unsigned int CErrorStack::Count()
{
TStack *cStack = m_cErrors.get();
return cStack->size() - 1;
}
示例6: Clear
void CErrorStack::Clear()
{
TStack *cStack = m_cErrors.get();
while (cStack->size() > 1)
cStack->pop();
}
示例7: Pop
void CErrorStack::Pop()
{
TStack *cStack = m_cErrors.get();
if (cStack->size() > 1)
cStack->pop();
}