soutangquan6309
soutangquan6309
2017-11-02 07:04

C++ set频繁查找、删除和插入操作,程序闪退

100
  • c++
  • set
  • 闪退
  • iterator-迭代器

请帮忙看下下面这段代码,当数据量比较小时,没有问题,但是数据达到一定量时(我测试的是集合s_facet_数据量达到6500)程序闪退

        if (it_e1 != s_edge_.end())
        {
            Edge a_e1(*it_e1);//copy
            //a_e1 = *it_e1;
            s_edge_.erase(it_e1++);//delete
            a_e1.fs_inx_[1] = m_facet.f_inx_; //chage value
            s_edge_.insert(it_e1,a_e1);

            m_facet.es_inx_[0] = a_e1.e_inx_;
            m_facet.adj_face_inx_[m_facet.adj_face_num_] = a_e1.fs_inx_[0];
            m_facet.adj_face_num_++;

            Facet a_facet1;
            a_facet1.f_inx_ = a_e1.fs_inx_[0];
            It_Facet it_a_facet1 = s_facet_.find(a_facet1);
            a_facet1=*it_a_facet1;
            s_facet_.erase(it_a_facet1++);
            a_facet1.adj_face_inx_[a_facet1.adj_face_num_++] = m_facet.f_inx_;
            //a_facet1.adj_face_num_++;
            s_facet_.insert(it_a_facet1,a_facet1);

// //delete it_a_facet;

        }

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐