• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ptr_vector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: swap

 inline void swap( ptr_vector<T,CA,A>& l, ptr_vector<T,CA,A>& r )
 {
     l.swap(r);
 }
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:4,代码来源:ptr_vector.hpp


示例2: insert

void rule_properties::insert(ptr_vector<rule>& rules, rule* r) {
    if (rules.empty() || rules.back() != r) {
        rules.push_back(r);
    }
}
开发者ID:AleksandarZeljic,项目名称:z3,代码行数:5,代码来源:rule_properties.cpp


示例3: mergeClass

static
void mergeClass(ptr_vector<VertexInfo> &infos, NGHolder &g, unsigned eq_class,
                VertexInfoSet &cur_class_vertices, set<NFAVertex> *toRemove) {
    DEBUG_PRINTF("Replacing %zd vertices from equivalence class %u with a "
                 "single vertex.\n", cur_class_vertices.size(), eq_class);

    // replace equivalence class with a single vertex:
    // 1. create new vertex with matching properties
    // 2. wire all predecessors to new vertex
    // 2a. update info for new vertex with new predecessors
    // 2b. update each predecessor's successor list
    // 3. wire all successors to new vertex
    // 3a. update info for new vertex with new successors
    // 3b. update each successor's predecessor list
    // 4. remove old vertex

    // any differences between vertex properties were resolved during
    // initial partitioning, so we assume that every vertex in equivalence
    // class has the same CharReach et al.
    // so, we find the first vertex in our class and get all its properties

    /* For left equivalence, if the members have different reporting behaviour
     * we sometimes require two vertices to be created (one connected to accept
     * and one to accepteod) */

    NFAVertex old_v = (*cur_class_vertices.begin())->v;
    NFAVertex new_v = clone_vertex(g, old_v); /* set up new vertex with same
                                               * props */
    g[new_v].reports.clear(); /* populated as we pull in succs */

    VertexInfo *new_vertex_info = new VertexInfo(new_v, g);
    // store this vertex in our global vertex list
    infos.push_back(new_vertex_info);

    NFAVertex new_v_eod = NGHolder::null_vertex();
    VertexInfo *new_vertex_info_eod = nullptr;

    if (require_separate_eod_vertex(cur_class_vertices, g)) {
        new_v_eod = clone_vertex(g, old_v);
        g[new_v_eod].reports.clear();
        new_vertex_info_eod = new VertexInfo(new_v_eod, g);
        infos.push_back(new_vertex_info_eod);
    }

    const unsigned edgetop = (*cur_class_vertices.begin())->edge_top;
    for (VertexInfo *old_vertex_info : cur_class_vertices) {
        assert(old_vertex_info->equivalence_class == eq_class);

        // mark this vertex for removal
        toRemove->insert(old_vertex_info->v);

        // for each predecessor, add edge to new vertex and update info
        for (VertexInfo *pred_info : old_vertex_info->pred) {
            // update info for new vertex
            new_vertex_info->pred.insert(pred_info);
            if (new_vertex_info_eod) {
                new_vertex_info_eod->pred.insert(pred_info);
            }

            // update info for predecessor
            pred_info->succ.erase(old_vertex_info);

            // if edge doesn't exist, create it
            NFAEdge e = add_edge_if_not_present(pred_info->v, new_v, g).first;

            // put edge top, if applicable
            if (edgetop != (unsigned) -1) {
                g[e].top = edgetop;
            }

            pred_info->succ.insert(new_vertex_info);

            if (new_v_eod) {
                NFAEdge ee = add_edge_if_not_present(pred_info->v, new_v_eod,
                                                     g).first;

                // put edge top, if applicable
                if (edgetop != (unsigned) -1) {
                    g[ee].top = edgetop;
                }

                pred_info->succ.insert(new_vertex_info_eod);
            }
        }

        // for each successor, add edge from new vertex and update info
        for (VertexInfo *succ_info : old_vertex_info->succ) {
            NFAVertex succ_v = succ_info->v;

            // update info for successor
            succ_info->pred.erase(old_vertex_info);

            if (new_v_eod && succ_v == g.acceptEod) {
                // update info for new vertex
                new_vertex_info_eod->succ.insert(succ_info);
                insert(&g[new_v_eod].reports,
                       g[old_vertex_info->v].reports);

                add_edge_if_not_present(new_v_eod, succ_v, g);
                succ_info->pred.insert(new_vertex_info_eod);
//.........这里部分代码省略.........
开发者ID:01org,项目名称:hyperscan,代码行数:101,代码来源:ng_equivalence.cpp


示例4: iz3pp

void iz3pp(ast_manager &m,
	   const ptr_vector<expr> &cnsts_vec,
	   expr *tree,
	   std::ostream& out) {

  unsigned sz = cnsts_vec.size();
  expr* const* cnsts = &cnsts_vec[0];

  out << "(set-option :produce-interpolants true)\n";

  free_func_visitor visitor(m);
  expr_mark visited;
  bool print_low_level = true; // m_params.print_low_level_smt2();

#define PP(_e_) if (print_low_level) out << mk_smt_pp(_e_, m); else ast_smt2_pp(out, _e_, env);

  smt2_pp_environment_dbg env(m);

  for (unsigned i = 0; i < sz; ++i) {
    expr* e = cnsts[i];
    for_each_expr(visitor, visited, e);
  }

  // name all the constraints
  hash_map<expr *, symbol> cnames;
  int ctr = 1;
  for(unsigned i = 0; i < sz; i++){
    symbol nm;
    std::ostringstream s;
    s << "f!" << (ctr++);
    cnames[cnsts[i]] = symbol(s.str().c_str());
  }

  func_decl_set &funcs = visitor.funcs();
  func_decl_set::iterator it  = funcs.begin(), end = funcs.end();

  obj_hashtable<class sort>& sorts = visitor.sorts();
  obj_hashtable<class sort>::iterator sit = sorts.begin(), send = sorts.end();



  for (; sit != send; ++sit) {
    PP(*sit);
  }

  for (; it != end; ++it) {
    func_decl* f = *it;
    if(f->get_family_id() == null_family_id){
      PP(f);
      out << "\n";
    }
  }

  for (unsigned i = 0; i < sz; ++i) {
    out << "(assert ";
    expr* r = cnsts[i];
    symbol nm = cnames[r];
    out << "(! ";
    PP(r);
    out << " :named ";
    if (is_smt2_quoted_symbol(nm)) {
      out << mk_smt2_quoted_symbol(nm);
    }
    else {
      out << nm;
    }
    out << ")";
    out << ")\n";
  }
  out << "(check-sat)\n";
  out << "(get-interpolant ";
  iz3pp_helper pp(m);
  pp.print_tree(pp.cook(tree),cnames,out);
  out << ")\n";
}
开发者ID:jackluo923,项目名称:juxta,代码行数:75,代码来源:iz3pp.cpp


示例5: get_formulas

void goal::get_formulas(ptr_vector<expr> & result) {
    unsigned sz = size();
    for (unsigned i = 0; i < sz; i++) {
        result.push_back(form(i));
    }
}
开发者ID:jackluo923,项目名称:juxta,代码行数:6,代码来源:goal.cpp


示例6: get_unsat_core

 virtual void get_unsat_core(ptr_vector<expr> & r) {
     SASSERT(m_context);
     unsigned sz = m_context->get_unsat_core_size();
     for (unsigned i = 0; i < sz; i++)
         r.push_back(m_context->get_unsat_core_expr(i));
 }
开发者ID:Moondee,项目名称:Artemis,代码行数:6,代码来源:solver.cpp


示例7: set_next_arg

 virtual void set_next_arg(cmd_context & ctx, expr * arg) {
     m_targets.push_back(arg);
 }
开发者ID:CHolmes3,项目名称:z3,代码行数:3,代码来源:interpolant_cmds.cpp


示例8: reduce

    void reduce(proof* pf, proof_ref &out)
    {
        proof *res = NULL;

        m_todo.reset();
        m_todo.push_back(pf);
        ptr_buffer<proof> args;
        bool dirty = false;

        while (!m_todo.empty()) {
            proof *p, *tmp, *pp;
            unsigned todo_sz;

            p = m_todo.back();
            if (m_cache.find(p, tmp)) {
                res = tmp;
                m_todo.pop_back();
                continue;
            }

            dirty = false;
            args.reset();
            todo_sz = m_todo.size();
            for (unsigned i = 0, sz = m.get_num_parents(p); i < sz; ++i) {
                pp = m.get_parent(p, i);
                if (m_cache.find(pp, tmp)) {
                    args.push_back(tmp);
                    dirty = dirty || pp != tmp;
                } else {
                    m_todo.push_back(pp);
                }
            }

            if (todo_sz < m_todo.size()) { continue; }
            else { m_todo.pop_back(); }

            if (m.is_hypothesis(p)) {
                // hyp: replace by a corresponding unit
                if (m_units.find(m.get_fact(p), tmp)) {
                    res = tmp;
                } else { res = p; }
            }

            else if (!dirty) { res = p; }

            else if (m.is_lemma(p)) {
                //lemma: reduce the premise; remove reduced consequences from conclusion
                SASSERT(args.size() == 1);
                res = mk_lemma_core(args.get(0), m.get_fact(p));
                compute_mark1(res);
            } else if (m.is_unit_resolution(p)) {
                // unit: reduce untis; reduce the first premise; rebuild unit resolution
                res = mk_unit_resolution_core(args.size(), args.c_ptr());
                compute_mark1(res);
            } else  {
                // other: reduce all premises; reapply
                if (m.has_fact(p)) { args.push_back(to_app(m.get_fact(p))); }
                SASSERT(p->get_decl()->get_arity() == args.size());
                res = m.mk_app(p->get_decl(), args.size(), (expr * const*)args.c_ptr());
                m_pinned.push_back(res);
                compute_mark1(res);
            }

            SASSERT(res);
            m_cache.insert(p, res);

            if (m.has_fact(res) && m.is_false(m.get_fact(res))) { break; }
        }

        out = res;
    }
开发者ID:greatmazinger,项目名称:z3,代码行数:71,代码来源:proof_utils.cpp


示例9: prepare

 virtual void prepare(cmd_context & ctx) { 
     parametric_cmd::prepare(ctx);
     m_targets.resize(0);
 }
开发者ID:CHolmes3,项目名称:z3,代码行数:4,代码来源:interpolant_cmds.cpp


示例10:

 ~datatype_decl() {
     std::for_each(m_constructors.begin(), m_constructors.end(), delete_proc<constructor_decl>());
 }
开发者ID:EinNarr,项目名称:z3,代码行数:3,代码来源:datatype_decl_plugin.cpp


示例11: set_next_arg

 void set_next_arg(cmd_context & ctx, expr * arg) override {
     m_targets.push_back(arg);
 }
开发者ID:chadbrewbaker,项目名称:z3,代码行数:3,代码来源:interpolant_cmds.cpp


示例12: prepare

 void prepare(cmd_context & ctx) override {
     parametric_cmd::prepare(ctx);
     m_targets.resize(0);
 }
开发者ID:chadbrewbaker,项目名称:z3,代码行数:4,代码来源:interpolant_cmds.cpp


示例13: add_parent

 void add_parent(term* p) { m_parents.push_back(p); }
开发者ID:NikolajBjorner,项目名称:z3,代码行数:1,代码来源:qe_term_graph.cpp


示例14: visit

 void visit(func_decl * f, bool & visited) {
     if (get_color(f) != CLOSED) {
         m_todo.push_back(f);
         visited = false;
     }
 }
开发者ID:annachen368,项目名称:HadoopStreamingTester,代码行数:6,代码来源:func_decl_dependencies.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ptree类代码示例发布时间:2022-05-31
下一篇:
C++ ptr_type类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap