本文整理汇总了C++中boost::container::flat_map::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ flat_map::clear方法的具体用法?C++ flat_map::clear怎么用?C++ flat_map::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::container::flat_map
的用法示例。
在下文中一共展示了flat_map::clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
std::cout << "Element size: " << sizeof(map_element) << std::endl;
std::cout << "std::map: ";
run_tests(packet_collector_thread_std_map);
DataCounter.clear();
#ifndef __APPLE__
std::cout << "tbb::concurrent_unordered_map: ";
run_tests(packet_collector_thread_unordered_concurrent_map);
DataCounterUnorderedConcurrent.clear();
#endif
// Boost unordered map
std::cout << "boost::unordered_map: ";
run_tests(packet_collector_thread_boost_unordered_map);
DataCounterBoostUnordered.clear();
// Boost flat_map
DataCounterBoostFlatMap.reserve( number_of_ips );
std::cout << "boost::container::flat_map with preallocated elements: ";
run_tests(packet_collector_thread_flat_map_preallocated);
DataCounterBoostFlatMap.clear();
std::cout << "std::unordered_map C++11: ";
run_tests(packet_collector_thread_unordered_map);
DataCounterUnordered.clear();
// Preallocate hash buckets
DataCounterUnorderedPreallocated.reserve( number_of_ips );
std::cout << "std::unordered_map C++11 preallocated buckets: ";
run_tests(packet_collector_thread_unordered_map_preallocated);
DataCounterUnorderedPreallocated.clear();
// Preallocate vector
DataCounterVector.reserve( number_of_ips );
std::cout << "std::vector preallocated: ";
run_tests(packet_collector_thread_vector);
DataCounterVector.clear();
}
示例2: update
void workflow_system::update(const double duration_ms) {
if (dirty) {
automatic_reactions.clear();
// Enumerate buildings and see which ones have reactions.
each<position_t, building_t>([this] (entity_t &e, position_t &pos, building_t &b) {
if (b.complete) {
auto finder = reaction_building_defs.find(b.tag);
if (finder != reaction_building_defs.end()) {
for (const std::string &reaction_name : finder->second) {
auto reactor = reaction_defs.find(reaction_name);
if (reactor != reaction_defs.end()) {
// Automatic reactions are added to the auto reactor list
if (reactor->second.automatic) {
auto automatic_finder = automatic_reactions.find(e.id);
if (automatic_finder == automatic_reactions.end()) {
automatic_reactions[e.id] = std::vector<std::string>{ reaction_name };
} else {
automatic_finder->second.push_back(reaction_name);
}
}
}
}
}
}
});
// Erase all completed jobs
designations->build_orders.erase(
std::remove_if(designations->build_orders.begin(),
designations->build_orders.end(),
[] (auto order_pair) { return order_pair.first == 0; }),
designations->build_orders.end());
// Not dirty anymore!
dirty = false;
}
}
示例3: UnregisterFileSystems
void UnregisterFileSystems() {
filesystem_map.clear();
}
示例4: UnregisterArchiveTypes
void UnregisterArchiveTypes() {
id_code_map.clear();
}