本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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);
}
}
示例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);
}
}
}
}
示例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());
}
}
}
示例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);
}
}
示例8: addCow
void addCow(xtype x, ytype y) {
cows.emplace(x,y);
}