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


C++ dictionary::find方法代码示例

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


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

示例1: insert

 void insert(symbol const & name, param_kind k, char const * descr) {
     SASSERT(!name.is_numerical());
     info i;
     if (m_info.find(name, i)) {
         SASSERT(i.first == k);
         return;
     }
     m_info.insert(name, info(k, descr));
     m_names.push_back(name);
 }
开发者ID:sukwon0709,项目名称:byterun,代码行数:10,代码来源:params.cpp

示例2: get_module

 // unfortunately, params_ref is not thread safe
 // so better create a local copy of the parameters.
 params_ref get_module(symbol const & module_name) {
     params_ref result;
     params_ref * ps = nullptr;
     #pragma omp critical (gparams)
     {
         if (m_module_params.find(module_name, ps)) {
             result.copy(*ps);
         }
     }
     return result;
 }
开发者ID:levnach,项目名称:z3,代码行数:13,代码来源:gparams.cpp

示例3: register_module

 void register_module(char const * module_name, param_descrs * d) {
     // Don't need synchronization here, this method
     // is invoked from check_registered that is already protected.
     symbol s(module_name);
     param_descrs * old_d;
     if (m_module_param_descrs.find(s, old_d)) {
         old_d->copy(*d);
         dealloc(d);
     }
     else {
         m_module_param_descrs.insert(s, d);
     }
 }
开发者ID:levnach,项目名称:z3,代码行数:13,代码来源:gparams.cpp

示例4: alloc

 params_ref & get_params(symbol const & mod_name) {
     if (mod_name == symbol::null) {
         return m_params;
     }
     else {
         params_ref * p = nullptr;
         if (!m_module_params.find(mod_name, p)) {
             p = alloc(params_ref);
             m_module_params.insert(mod_name, p);
         }
         SASSERT(p != 0);
         return *p;
     }
 }
开发者ID:levnach,项目名称:z3,代码行数:14,代码来源:gparams.cpp

示例5: processWord

/*
 * Given a word, add it to the dictionary, increment its count
 * and add the line number on which it was found.
 */
void processWord(string& word, dictionary& dict, int lineNumber) {
    if (word.size() > 0) {
        dictionary::iterator itr = dict.find(word);
        if (itr == dict.end()) {
            dict[word] = pair<int, vector<int> >(1, vector<int>(1, lineNumber));
        } else {
            pair<int, vector<int> > value = itr->second;
            ++(value.first);
            value.second.push_back(lineNumber);

            // Update the dictionary reference
            dict[word] = value;
        }
    }
}
开发者ID:abhishek-kumar,项目名称:bow_parser,代码行数:19,代码来源:bow_parser.C

示例6: get_value

 std::string get_value(char const * name) {
     std::string r;
     bool error = false;
     std::string error_msg;
     #pragma omp critical (gparams)
     {
         try {
             symbol m, p;
             normalize(name, m, p);
             if (m == symbol::null) {
                 if (m_params.contains(p)) {
                     r = get_value(m_params, p);
                 }
                 else {
                     r = get_default(get_param_descrs(), p, m);
                 }
             }
             else {
                 params_ref * ps = nullptr;
                 if (m_module_params.find(m, ps) && ps->contains(p)) {
                     r = get_value(*ps, p);
                 }
                 else {
                     param_descrs * d;
                     if (get_module_param_descrs().find(m, d)) {
                         r = get_default(*d, p, m);
                     }
                     else {
                         std::stringstream strm;
                         strm << "unknown module '" << m << "'";
                         throw exception(strm.str());
                     }
                 }
             }
         }
         catch (z3_exception & ex) {
             // Exception cannot cross critical section boundaries.
             error = true;
             error_msg = ex.msg();
         }
     }
     if (error)
         throw exception(std::move(error_msg));
     return r;
 }
开发者ID:levnach,项目名称:z3,代码行数:45,代码来源:gparams.cpp

示例7: display

 void display(std::ostream & out, unsigned indent) const {
     svector<symbol> names;
     dictionary<info>::iterator it  = m_info.begin();
     dictionary<info>::iterator end = m_info.end();
     for (; it != end; ++it) {
         names.push_back(it->m_key);
     }
     std::sort(names.begin(), names.end(), lt());
     svector<symbol>::iterator it2  = names.begin();
     svector<symbol>::iterator end2 = names.end();
     for (; it2 != end2; ++it2) {
         for (unsigned i = 0; i < indent; i++) out << " ";
         out << *it2;
         info d;
         d.second = 0;
         m_info.find(*it2, d);
         SASSERT(d.second);
         out << " (" << d.first << ") " << d.second << "\n";
     }
 }
开发者ID:sukwon0709,项目名称:byterun,代码行数:20,代码来源:params.cpp

示例8: display

 void display(std::ostream & out, unsigned indent, bool smt2_style, bool include_descr) const {
     svector<symbol> names;
     dictionary<info>::iterator it  = m_info.begin();
     dictionary<info>::iterator end = m_info.end();
     for (; it != end; ++it) {
         names.push_back(it->m_key);
     }
     std::sort(names.begin(), names.end(), lt());
     svector<symbol>::iterator it2  = names.begin();
     svector<symbol>::iterator end2 = names.end();
     for (; it2 != end2; ++it2) {
         for (unsigned i = 0; i < indent; i++) out << " ";
         if (smt2_style)
             out << ':';
         char const * s = it2->bare_str();
         unsigned n = static_cast<unsigned>(strlen(s));
         for (unsigned i = 0; i < n; i++) {
             if (smt2_style && s[i] == '_')
                 out << '-';
             else if (!smt2_style && s[i] == '-')
                 out << '_';
             else if (s[i] >= 'A' && s[i] <= 'Z')
                 out << (s[i] - 'A' + 'a');
             else 
                 out << s[i];
         }
         info d;
         m_info.find(*it2, d);
         SASSERT(d.m_descr);
         out << " (" << d.m_kind << ")";
         if (include_descr)
             out << " " << d.m_descr;
         if (d.m_default != 0)
             out << " (default: " << d.m_default << ")";
         out << "\n";
     }
 }
开发者ID:greatmazinger,项目名称:z3,代码行数:37,代码来源:params.cpp

示例9: get_kind

 param_kind get_kind(symbol const & name) const {
     info i;
     if (m_info.find(name, i))
         return i.first;
     return CPK_INVALID;
 }
开发者ID:sukwon0709,项目名称:byterun,代码行数:6,代码来源:params.cpp

示例10:

 char const * get_default(symbol const & name) const {
     info i;
     if (m_info.find(name, i))
         return i.m_default;
     return 0;
 }
开发者ID:greatmazinger,项目名称:z3,代码行数:6,代码来源:params.cpp

示例11: get_module

 char const* get_module(symbol const& name) const {
     info i;
     if (m_info.find(name, i)) 
         return i.m_module;
     return 0;
 }
开发者ID:greatmazinger,项目名称:z3,代码行数:6,代码来源:params.cpp


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