本文整理汇总了C++中Manifest::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Manifest::push_back方法的具体用法?C++ Manifest::push_back怎么用?C++ Manifest::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Manifest
的用法示例。
在下文中一共展示了Manifest::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: popQty
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Manifest ResourceBuff::popQty(double qty) {
if (qty - quantity() > STORE_EPS) {
throw CycNegQtyException("Removal quantity larger than store tot quantity.");
}
if (qty < 0.0) {
throw CycNegQtyException("Removal quantity cannot be negative.");
}
Manifest manifest;
rsrc_ptr mat, leftover;
double left = qty;
double quan;
while (left > STORE_EPS) {
mat = mats_.front();
mats_.pop_front();
quan = mat->quantity();
if ((quan - left) > STORE_EPS) {
// too big - split the mat before pushing
leftover = mat->clone();
leftover->setQuantity(quan - left);
mat->setQuantity(left);
mats_.push_front(leftover);
}
manifest.push_back(mat);
left -= quan;
}
return manifest;
}
示例2: popNum
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Manifest ResourceBuff::popNum(int num) {
if (mats_.size() < num) {
throw CycNegQtyException("Remove count larger than store count.");
}
Manifest manifest;
for (int i = 0; i < num; i++) {
manifest.push_back(mats_.front());
mats_.pop_front();
}
return manifest;
}