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


C++ slist_type::erase方法代码示例

本文整理汇总了C++中slist_type::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ slist_type::erase方法的具体用法?C++ slist_type::erase怎么用?C++ slist_type::erase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在slist_type的用法示例。


在下文中一共展示了slist_type::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: erase_duplicate_segments

                /**
                 * Find duplicate segments (ie same start and end point) in the
                 * list and remove them. This will always remove pairs of the
                 * same segment. So if there are three, for instance, two will
                 * be removed and one will be left.
                 */
                uint32_t erase_duplicate_segments(osmium::area::ProblemReporter* problem_reporter) {
                    uint32_t duplicate_segments = 0;

                    while (true) {
                        auto it = std::adjacent_find(m_segments.begin(), m_segments.end());
                        if (it == m_segments.end()) {
                            break;
                        }
                        if (m_debug) {
                            std::cerr << "  erase duplicate segment: " << *it << "\n";
                        }

                        // Only count and report duplicate segments if they
                        // belong to the same way or if they don't both have
                        // the role "inner". Those cases are definitely wrong.
                        // If the duplicate segments belong to different
                        // "inner" ways, they could be touching inner rings
                        // which are perfectly okay. Note that for this check
                        // the role has to be correct in the member data.
                        if (it->way() == std::next(it)->way() || !it->role_inner() || !std::next(it)->role_inner()) {
                            ++duplicate_segments;
                            if (problem_reporter) {
                                problem_reporter->report_duplicate_segment(it->first(), it->second());
                            }
                        }
                        m_segments.erase(it, it+2);
                    }

                    return duplicate_segments;
                }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:36,代码来源:segment_list.hpp

示例2: erase_duplicate_segments

 /**
  * Find duplicate segments (ie same start and end point) in the
  * list and remove them. This will always remove pairs of the same
  * segment. So if there are three, for instance, two will be
  * removed and one will be left.
  */
 void erase_duplicate_segments() {
     while (true) {
         auto it = std::adjacent_find(m_segments.begin(), m_segments.end());
         if (it == m_segments.end()) {
             return;
         }
         if (m_debug) {
             std::cerr << "  erase duplicate segment: " << *it << "\n";
         }
         m_segments.erase(it, it+2);
     }
 }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:18,代码来源:segment_list.hpp


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