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


C++ unordered_set::emplace方法代码示例

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


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

示例1: readAll

bool SingleServerEdgeCursor::readAll(std::unordered_set<VPackSlice>& result,
                                     size_t& cursorId) {
  if (_currentCursor >= _cursors.size()) {
    return false;
  }
  
  if (_internalCursorMapping != nullptr) {
    TRI_ASSERT(_currentCursor < _internalCursorMapping->size());
    cursorId = _internalCursorMapping->at(_currentCursor);
  } else {
    cursorId = _currentCursor;
  }
  
  auto& cursorSet = _cursors[_currentCursor];
  for (auto& cursor : cursorSet) {
    LogicalCollection* collection = cursor->collection(); 
    while (cursor->hasMore()) {
      // NOTE: We cannot clear the cache,
      // because the cursor expect's it to be filled.
      cursor->getMoreMptr(_cache);
      for (auto const& element : _cache) {
        TRI_voc_rid_t revisionId = element.revisionId();
        if (collection->readRevision(_trx, *_mmdr, revisionId)) {
          result.emplace(_mmdr->vpack());
        }
      }
    }
  }
  _currentCursor++;
  return true;
}
开发者ID:triagens,项目名称:arangodb,代码行数:31,代码来源:SingleServerTraverser.cpp

示例2: load_ini_category

void inifile_manager::load_ini_category(size_t file, size_t category, std::unordered_set<game_driver const *> &result) const
{
	std::string const &filename(m_ini_index[file].first);
	emu_file fp(m_options.categoryini_path(), OPEN_FLAG_READ);
	if (fp.open(filename) != osd_file::error::NONE)
	{
		osd_printf_error("Failed to open category file %s for reading\n", filename.c_str());
		return;
	}

	int64_t const offset(m_ini_index[file].second[category].second);
	if (fp.seek(offset, SEEK_SET) || (fp.tell() != offset))
	{
		fp.close();
		osd_printf_error("Failed to seek to category offset in file %s\n", filename.c_str());
		return;
	}

	char rbuf[MAX_CHAR_INFO];
	while (fp.gets(rbuf, MAX_CHAR_INFO) && rbuf[0] && ('[' != rbuf[0]))
	{
		auto const tail(std::find_if(std::begin(rbuf), std::prev(std::end(rbuf)), [] (char ch) { return !ch || ('\r' == ch) || ('\n' == ch); }));
		*tail = '\0';
		int const dfind(driver_list::find(rbuf));
		if (0 <= dfind)
			result.emplace(&driver_list::driver(dfind));
	}

	fp.close();
}
开发者ID:PugsyMAME,项目名称:mame,代码行数:30,代码来源:inifile.cpp

示例3:

	VectorCodec(std::string corpus, int vecLength = 0) {
		for (int i = 0; i < corpus.length(); i++) {
			alphabet.emplace(corpus[i]);
		}
		nSymbols = alphabet.size();
				
		if (vecLength == 0) { //auto
			N = nSymbols;
		} else {
			N = vecLength;
		}
		vector.resize(N, 0.0f);
		
		for (int i = 0; i < 256; i++) { tableStoI[i] = 0; tableItoS[i] = 0; }
		
		int index = 0;
		for (auto itr = alphabet.begin(); itr != alphabet.end(); ++itr) {
			tableStoI[*itr] = index;
			tableItoS[index] = *itr;
			index++;
		}
		
		symbol = 0;
		symIndex = 0;
	}
开发者ID:222464,项目名称:NeoRL-CPU,代码行数:25,代码来源:TextPrediction.cpp

示例4: collectApplicationSettings

	void ServerApplicationsTree::collectApplicationSettings(std::unordered_set<ServerApplicationSettings *> &set) const
	{
		for (auto l : list)
		{
			if (nullptr != l.second->app_sets)
			{
				set.emplace(l.second->app_sets);
			}

			l.second->collectApplicationSettings(set);
		}
	}
开发者ID:Ogureccc,项目名称:httpserver,代码行数:12,代码来源:ServerApplicationsTree.cpp

示例5: getVariablesUsedHere

/// @brief getVariablesUsedHere, modifying the set in-place
void CollectNode::getVariablesUsedHere(
    std::unordered_set<Variable const*>& vars) const {
  for (auto const& p : _groupVariables) {
    vars.emplace(p.second);
  }
  for (auto const& p : _aggregateVariables) {
    if (Aggregator::requiresInput(p.second.second)) {
      vars.emplace(p.second.first);
    }
  }

  if (_expressionVariable != nullptr) {
    vars.emplace(_expressionVariable);
  }

  if (_outVariable != nullptr && !_count) {
    if (_keepVariables.empty()) {
      // Here we have to find all user defined variables in this query
      // amongst our dependencies:
      UserVarFinder finder(1);
      auto myselfAsNonConst = const_cast<CollectNode*>(this);
      myselfAsNonConst->walk(&finder);
      if (finder.depth == 1) {
        // we are top level, let's run again with mindepth = 0
        finder.userVars.clear();
        finder.mindepth = 0;
        finder.depth = -1;
        finder.reset();
        myselfAsNonConst->walk(&finder);
      }
      for (auto& x : finder.userVars) {
        vars.emplace(x);
      }
    } else {
      for (auto& x : _keepVariables) {
        vars.emplace(x);
      }
    }
  }
}
开发者ID:JiangKevin,项目名称:arangodb,代码行数:41,代码来源:CollectNode.cpp

示例6: get

void JsonWrapper::get(const char* name,
                     const std::vector<std::string>& dflt,
                     std::unordered_set<std::string>& param) const {
  auto it = m_config[name];
  param.clear();
  if (it == Json::nullValue) {
    param.insert(dflt.begin(), dflt.end());
  } else {
    for (auto const& str : it) {
      param.emplace(str.asString());
    }
  }
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:13,代码来源:ConfigFiles.cpp

示例7: collectApplicationSettings

	void ServerApplicationsTree::collectApplicationSettings(std::unordered_set<ServerApplicationSettings *> &set) const
	{
		for (auto &node : this->list)
		{
			const ServerApplicationsTree *tree = node.second;

			if (nullptr != tree->app_sets) {
				set.emplace(tree->app_sets);
			}

			tree->collectApplicationSettings(set);
		}
	}
开发者ID:awwit,项目名称:httpserver,代码行数:13,代码来源:ServerApplicationsTree.cpp

示例8: addCow

	void addCow(xtype x, ytype y) {
		cows.emplace(x,y);
	}
开发者ID:golvok,项目名称:IEEEXtreme-9.0,代码行数:3,代码来源:extreme_driving.cpp


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