本文整理汇总了C++中hashmap::put方法的典型用法代码示例。如果您正苦于以下问题:C++ hashmap::put方法的具体用法?C++ hashmap::put怎么用?C++ hashmap::put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类hashmap
的用法示例。
在下文中一共展示了hashmap::put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addStock
static void addStock(const stock& s)
{
unsigned int usedIndex, hashIndex, symbolHash, chainLgth;
if (hm.put(s, symbolHash, hashIndex, usedIndex, chainLgth)) {
cout << "added " << left << setw(8) << s.getSymbol();
printAdditional(symbolHash, hashIndex, usedIndex, chainLgth);
}
else
cout << s.getSymbol() << " not added" << endl;
}
示例2: subscribe
void ResourceProviderManagerProcess::subscribe(
const HttpConnection& http,
const Call::Subscribe& subscribe)
{
ResourceProviderInfo resourceProviderInfo =
subscribe.resource_provider_info();
resourceProviderInfo.mutable_id()->CopyFrom(newResourceProviderId());
ResourceProvider resourceProvider(resourceProviderInfo, http);
Event event;
event.set_type(Event::SUBSCRIBED);
event.mutable_subscribed()->mutable_provider_id()->CopyFrom(
resourceProvider.info.id());
if (!resourceProvider.http.send(event)) {
LOG(WARNING) << "Unable to send event to resource provider "
<< stringify(resourceProvider.info.id())
<< ": connection closed";
}
resourceProviders.put(resourceProviderInfo.id(), std::move(resourceProvider));
}