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


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

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


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

示例1: 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

示例2: 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

示例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: filterEdgeListByNodeSet

void QEvalTmpResultCore::filterEdgeListByNodeSet(std::vector<std::pair<idx_t, idx_t> >& edgeList, bool filterLeft, const std::unordered_set<idx_t>& varIdxSet)
{
	std::vector<std::pair<idx_t, idx_t> >::const_iterator edgeIter = edgeList.cbegin();
	std::vector<std::pair<idx_t, idx_t> >::iterator edgewIter = edgeList.begin();
	if (filterLeft) {
		while (edgeIter != edgeList.cend()) {
			if (varIdxSet.find((*edgeIter).first) != varIdxSet.cend()) {
				*edgewIter = *edgeIter;
				edgewIter++;
			}
			edgeIter++;
		}
	}
	else {
		while (edgeIter != edgeList.cend()) {
			if (varIdxSet.find((*edgeIter).second) != varIdxSet.cend()) {
				*edgewIter = *edgeIter;
				edgewIter++;
			}
			edgeIter++;
		}
	}
	edgeList.erase(edgewIter, edgeList.end());
}
开发者ID:Pingxia,项目名称:CS3202_SPA,代码行数:24,代码来源:QEvalTmpResultCore.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: perform_and_exit

    void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
    {
        static const std::string example = Strings::format(
            "The argument should be a substring to search for, or no argument to display all libraries.\n%s",
            Commands::Help::create_example_string("search png"));
        args.check_max_arg_count(1, example);
        const std::unordered_set<std::string> options =
            args.check_and_get_optional_command_arguments({OPTION_GRAPH, OPTION_FULLDESC});

        auto sources_and_errors = Paragraphs::try_load_all_ports(paths.get_filesystem(), paths.ports);

        if (!sources_and_errors.errors.empty())
        {
            if (vcpkg::g_debugging)
            {
                print_error_message(sources_and_errors.errors);
            }
            else
            {
                for (auto&& error : sources_and_errors.errors)
                {
                    System::println(
                        System::Color::warning, "Warning: an error occurred while parsing '%s'", error->name);
                }
                System::println(System::Color::warning,
                                "Use '--debug' to get more information about the parse failures.\n");
            }
        }

        auto& source_paragraphs = sources_and_errors.paragraphs;
        if (options.find(OPTION_GRAPH) != options.cend())
        {
            const std::string graph_as_string = create_graph_as_string(source_paragraphs);
            System::println(graph_as_string);
            Checks::exit_success(VCPKG_LINE_INFO);
        }

        if (args.command_arguments.empty())
        {
            for (const auto& source_control_file : source_paragraphs)
            {
                do_print(*source_control_file->core_paragraph, options.find(OPTION_FULLDESC) != options.cend());
                for (auto&& feature_paragraph : source_control_file->feature_paragraphs)
                {
                    do_print(source_control_file->core_paragraph->name,
                             *feature_paragraph,
                             options.find(OPTION_FULLDESC) != options.cend());
                }
            }
        }
        else
        {
            const auto& icontains = Strings::case_insensitive_ascii_contains;

            // At this point there is 1 argument
            auto&& args_zero = args.command_arguments[0];
            for (const auto& source_control_file : source_paragraphs)
            {
                auto&& sp = *source_control_file->core_paragraph;

                bool contains_name = icontains(sp.name, args_zero);
                if (contains_name || icontains(sp.description, args_zero))
                {
                    do_print(sp, options.find(OPTION_FULLDESC) != options.cend());
                }

                for (auto&& feature_paragraph : source_control_file->feature_paragraphs)
                {
                    if (contains_name || icontains(feature_paragraph->name, args_zero) ||
                        icontains(feature_paragraph->description, args_zero))
                    {
                        do_print(sp.name, *feature_paragraph, options.find(OPTION_FULLDESC) != options.cend());
                    }
                }
            }
        }

        System::println(
            "\nIf your library is not listed, please open an issue at and/or consider making a pull request:\n"
            "    https://github.com/Microsoft/vcpkg/issues");

        Checks::exit_success(VCPKG_LINE_INFO);
    }
开发者ID:schmittjoseph,项目名称:vcpkg,代码行数:83,代码来源:commands_search.cpp

示例7: is_in

	static bool is_in(const T x, const std::unordered_set<T>& xs)
	{
		return(xs.find(x) != xs.cend());
	}
开发者ID:Wassasin,项目名称:splicpp,代码行数:4,代码来源:generic.hpp

示例8: 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

示例9: setValues

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

示例10: 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


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