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


C++ Cst::sibling方法代码示例

本文整理汇总了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;
	}
开发者ID:olydis,项目名称:sdsl-lite,代码行数:31,代码来源:cst_iterators.hpp

示例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);
}
开发者ID:bojifengyu,项目名称:RoSA,代码行数:21,代码来源:test_index_performance.hpp

示例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;
	}
开发者ID:olydis,项目名称:sdsl-lite,代码行数:16,代码来源:cst_iterators.hpp


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