本文整理汇总了C++中Cst::sibling方法的典型用法代码示例。如果您正苦于以下问题:C++ Cst::sibling方法的具体用法?C++ Cst::sibling怎么用?C++ Cst::sibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cst
的用法示例。
在下文中一共展示了Cst::sibling方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parent
//! Prefix increment of the iterator.
iterator& operator++()
{
if (!m_valid) return *this;
if (m_v == m_cst->root() and m_visited) {
m_valid = false;
return *this;
}
value_type w;
if (!m_visited) { // go down, if possible
if (m_cst->is_leaf(m_v)) {
w = m_cst->sibling(m_v); // determine sibling of leaf v
if (w == m_cst->root()) { // if there exists no right sibling of the leaf v
// w = m_cst->parent(m_v);
w = parent();
m_visited = true; // go up
}
} else { // v is not a leaf => go down the tree
w = first_child();
}
} else { //
w = m_cst->sibling(m_v);
if (w == m_cst->root()) { // if there exists no right sibling
w = parent();
} else {
m_visited = false;
}
}
m_v = w;
return *this;
}
示例2: test_cst_sibling_operation
void test_cst_sibling_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);
for (size_type i=0; i<nodes.size(); ++i) {
nodes[i] = cst.sibling(nodes[i]);
}
node_type c; // for sibling node
size_type cnt=0;
write_R_output("cst","sibling","begin",nodes.size(),cnt);
for (size_type i=0; i<nodes.size(); ++i) {
c = cst.sibling(nodes[i]);
if (c==cst.root())
++cnt;
}
write_R_output("cst","sibling","end",nodes.size(),cnt);
}
示例3:
//! Prefix increment of the iterator.
iterator& operator++()
{
if (!m_valid) return *this;
if (m_v == m_cst->root()) {
m_valid = false;
return *this;
}
value_type w = m_cst->sibling(m_v);
if (w == m_cst->root()) { // if no next right sibling exist
m_v = m_cst->parent(m_v); // go to parent
} else { // if next right sibling exist
m_v = m_cst->leftmost_leaf(w); // go to leaftmost leaf in the subtree of w
}
return *this;
}