当前位置: 首页>>代码示例>>C++>>正文


C++ flat_map::clear方法代码示例

本文整理汇总了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();
}
开发者ID:RolexColocat,项目名称:fastnetmon,代码行数:40,代码来源:traffic_structures_performance_tests.cpp

示例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;
    }
}
开发者ID:thebracket,项目名称:bgame,代码行数:39,代码来源:workflow_system.cpp

示例3: UnregisterFileSystems

void UnregisterFileSystems() {
    filesystem_map.clear();
}
开发者ID:restonexyz,项目名称:yuzu-NintendoSwitchEmulator,代码行数:3,代码来源:filesystem.cpp

示例4: UnregisterArchiveTypes

void UnregisterArchiveTypes() {
    id_code_map.clear();
}
开发者ID:FenrisulfrX,项目名称:citra,代码行数:3,代码来源:archive.cpp


注:本文中的boost::container::flat_map::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。