本文整理汇总了C++中BinTree::retrieve方法的典型用法代码示例。如果您正苦于以下问题:C++ BinTree::retrieve方法的具体用法?C++ BinTree::retrieve怎么用?C++ BinTree::retrieve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinTree
的用法示例。
在下文中一共展示了BinTree::retrieve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retrieveItem
// ---------------------------------------------------------------------------
// retrieveItem
// Takes the Item and compares it's value in the correct BinTree found after
// using itemCode to hash to correct key
Item* Inventory::retrieveItem(const Item *obj, char itemCode) const
{
BinTree *storageTree = storage[hash(itemCode)];
Item *retrieved = NULL;
storageTree->retrieve(obj, retrieved);
return retrieved;
}
示例2: setCustomer
//------------------------------------------------ setCustomer()
void Borrow::setCustomer(istream& in, BinTree& cust) {
int customerID = 0;
in >> customerID;
Customer target(customerID); // empty instance with only id
Generic* customerInStore = NULL;
cust.retrieve(target, customerInStore);
// pointer is now modified to point to the customer in our store
if(customerInStore != NULL) { // if found
// down-cast and store reference
customer = dynamic_cast<Customer*>(customerInStore);
} else {
customer = NULL;
}
// target goes out of scope and gets destroyed
}