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


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

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


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

示例1:

/*! Removes the option \a name from \a optSet. If the option is not present
    \c false is returned, \c true otherwise.

    \param[in] optSet OptionSet to modify.
    \param[in] name   Name of the option.
    \return Whether the option was successfully removed.
 */
bool
IOFileTypeBase::unsetOption(OptionSet &optSet, const std::string &name)
{
    bool                retVal = false;
    OptionSet::iterator oIt    = optSet.find(name);
    
    if(oIt != optSet.end())
    {
        optSet.erase(oIt);
        retVal = true;
    }
    
    return retVal;
}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:21,代码来源:OSGIOFileTypeBase.cpp

示例2: OptionsSetDiff

size_t Options::OptionsSetDiff(const OptionSet &set_a, const OptionSet &set_b,
                               OptionSet &diffs) {
  size_t num_diffs = 0;
  OptionSet::const_iterator pos_a;
  OptionSet::const_iterator pos_b;

  for (pos_a = set_a.begin(); pos_a != set_a.end(); ++pos_a) {
    pos_b = set_b.find(*pos_a);
    if (pos_b == set_b.end()) {
      ++num_diffs;
      diffs.insert(*pos_a);
    }
  }

  return num_diffs;
}
开发者ID:kraj,项目名称:lldb,代码行数:16,代码来源:Options.cpp

示例3: IsASubset

bool Options::IsASubset(const OptionSet &set_a, const OptionSet &set_b) {
  bool is_a_subset = true;
  OptionSet::const_iterator pos_a;
  OptionSet::const_iterator pos_b;

  // set_a is a subset of set_b if every member of set_a is also a member of
  // set_b

  for (pos_a = set_a.begin(); pos_a != set_a.end() && is_a_subset; ++pos_a) {
    pos_b = set_b.find(*pos_a);
    if (pos_b == set_b.end())
      is_a_subset = false;
  }

  return is_a_subset;
}
开发者ID:kraj,项目名称:lldb,代码行数:16,代码来源:Options.cpp

示例4: OptionsSetUnion

void Options::OptionsSetUnion(const OptionSet &set_a, const OptionSet &set_b,
                              OptionSet &union_set) {
  OptionSet::const_iterator pos;
  OptionSet::iterator pos_union;

  // Put all the elements of set_a into the union.

  for (pos = set_a.begin(); pos != set_a.end(); ++pos)
    union_set.insert(*pos);

  // Put all the elements of set_b that are not already there into the union.
  for (pos = set_b.begin(); pos != set_b.end(); ++pos) {
    pos_union = union_set.find(*pos);
    if (pos_union == union_set.end())
      union_set.insert(*pos);
  }
}
开发者ID:kraj,项目名称:lldb,代码行数:17,代码来源:Options.cpp


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