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


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

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


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

示例1: children

	std::unordered_set<zsr::filecount> disktree::subtree_closure(zsr::offset nodepos)
	{
		std::unordered_set<zsr::filecount> ret{};
		const char *inptr = base_ + nodepos;
		// FIXME Bounds checking
		const std::unordered_map<std::string, zsr::offset> curchild = children(inptr);
		const std::unordered_set<zsr::filecount> myval = values(inptr);
		ret.insert(myval.cbegin(), myval.cend());
		for (const std::pair<const std::string, zsr::offset> &child : curchild)
		{
			if (child.second == nodepos) throw std::runtime_error{"Loop detected in search tree"};
			const std::unordered_set<zsr::filecount> curval = subtree_closure(child.second);
			ret.insert(curval.cbegin(), curval.cend());
		}
		return ret;
	}
开发者ID:showermat,项目名称:zsr-utils,代码行数:16,代码来源:search.cpp

示例2: add

void glpk_wrapper::add(std::unordered_set<Enode *> const & es) {
    int idx = glp_add_rows(lp, es.size());
    for (auto it = es.cbegin(); it != es.cend(); ++it) {
        set_constraint(idx, *it);
        idx += 1;
    }
}
开发者ID:jadecastro,项目名称:dreal3,代码行数:7,代码来源:glpk_wrapper.cpp

示例3: AddIndex

void PartitionOpLogIndex::AddIndex(const std::unordered_set<int32_t>
                                   &oplog_index) {
  smtx_.lock_shared();
  for (auto iter = oplog_index.cbegin(); iter != oplog_index.cend(); iter++) {
    locks_.Lock(*iter);
    shared_oplog_index_->insert(*iter, true);
    locks_.Unlock(*iter);
  }
  smtx_.unlock_shared();
}
开发者ID:Nikraaaazy,项目名称:bosen,代码行数:10,代码来源:oplog_index.cpp

示例4: populateTopic

  // Function to randomly populate a topic
  void populateTopic(const unsigned long long int &a_num_words, const std::unordered_set<std::string> &a_vocabulary)
  {
    d_word_topic_allocations.reserve(a_vocabulary.size()); // Make the map the size of the vocabulary
    unsigned long long int l_unallocated_number_of_words = a_num_words; // Number of words not yet allocated
    unsigned int l_unallocated_words_in_topic = a_vocabulary.size(); // Number of words for each topic distribution
    unsigned l_seed = std::chrono::system_clock::now().time_since_epoch().count(); // Seed generator for randomly allocating words in topic
    std::default_random_engine l_generator (l_seed); // Seed generator
    unsigned long long int l_new_words_allocated; // Temporary variable counting number of words allocated for current topic during an iteration
    for (std::unordered_set<std::string>::const_iterator it = a_vocabulary.cbegin(); it!=a_vocabulary.cend(); ++it)
      {
	l_new_words_allocated = newBinomial(l_unallocated_number_of_words,l_unallocated_words_in_topic,l_generator); // Number of words allocated for current iteration
	d_word_topic_allocations[*it] = l_new_words_allocated; // Update map with the number of allocations for that word
	--l_unallocated_words_in_topic; // Decrement the number of words in the topic not yet allocated to
	l_unallocated_number_of_words -= l_new_words_allocated; // Decrease the number of words not yet allocated by the number allocated this iteration
	if (l_unallocated_number_of_words==0) {break;} // If no more words left to allocate, break
      }
  };
开发者ID:prateekpg2455,项目名称:BHLDA,代码行数:18,代码来源:BHLDAString.cpp

示例5: setEdgeIterNodeUpdate

void QEvalTmpResultCore::setEdgeIterNodeUpdate(UniqElemQueue<std::pair<size_t, size_t>>& nodePairQueue, size_t nodeId, size_t otherNodeId, const std::unordered_set<idx_t> &nodeSet)
{
	std::vector<idx_t> newNode;
	newNode.reserve(nodeSet.size());
	newNode.assign(nodeSet.cbegin(), nodeSet.cend());
	nodeLists[nodeId] = newNode;
	nodeHashSets[nodeId] = nodeSet;

	// push adj nodes except current edge
	std::vector<size_t>::const_iterator adjNodeIter;
	const std::vector<size_t> &adjNodeList = graph.getNodeAdjList(nodeId);
	for (adjNodeIter = adjNodeList.cbegin(); adjNodeIter != adjNodeList.cend(); adjNodeIter++) {
		if (*adjNodeIter != otherNodeId) {
			nodePairQueue.push(std::make_pair(nodeId, *adjNodeIter));
		}
	}
}
开发者ID:Pingxia,项目名称:CS3202_SPA,代码行数:17,代码来源:QEvalTmpResultCore.cpp

示例6: is_visited

 bool is_visited(std::string state) const
 {
     return visited_list.cend() != std::find(visited_list.cbegin(), visited_list.cend(), state);
 }
开发者ID:kevinzhang2012,项目名称:AI,代码行数:4,代码来源:bfs.hpp

示例7: setValues

void KeyMultiValueTagFilter::setValues(const std::unordered_set<std::string> & values)
{
	setValues(values.cbegin(), values.cend());
}
开发者ID:inphos42,项目名称:osmpbf,代码行数:4,代码来源:filter.cpp


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