本文整理汇总了C++中Cst::id方法的典型用法代码示例。如果您正苦于以下问题:C++ Cst::id方法的具体用法?C++ Cst::id怎么用?C++ Cst::id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cst
的用法示例。
在下文中一共展示了Cst::id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_cst_dfs_iterator_and_id
void test_cst_dfs_iterator_and_id(Cst& cst, typename Cst::size_type times=1000000, bool output=false)
{
if (times > 2*cst.nodes()-cst.size())
times = 2*cst.nodes()-cst.size();
typedef typename Cst::size_type size_type;
size_type cnt=0;
write_R_output("cst","dfs and id","begin",times,cnt);
typename Cst::const_iterator it = cst.begin();
if (!output) {
for (size_type i=0; i<times; ++i, ++it) {
cnt += cst.id(*it);
}
} else {
for (size_type i=0; i<times; ++i, ++it) {
size_type id = cst.id(*it);
std::cerr << id << std::endl;
cnt += id;
}
}
write_R_output("cst","dfs and id","end",times,cnt);
}
示例2: test_cst_id_operation
void test_cst_id_operation(const Cst& cst, typename Cst::size_type times=100000, uint64_t x=17)
{
typedef typename Cst::size_type size_type;
typedef typename Cst::node_type node_type;
std::vector<node_type> nodes;
generate_nodes_from_random_leaves(cst, times, nodes, x);
size_type cnt = 0;
write_R_output("cst","id","begin",nodes.size(),cnt);
for (size_type i=0; i < nodes.size(); ++i) {
cnt += cst.id(nodes[i]);
}
write_R_output("cst","id","end",nodes.size(),cnt);
}