本文整理汇总了C++中bit_vector_type类的典型用法代码示例。如果您正苦于以下问题:C++ bit_vector_type类的具体用法?C++ bit_vector_type怎么用?C++ bit_vector_type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了bit_vector_type类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: swap
//! Swap operator
void swap(wt_int_rlmn& wt) {
if (this != &wt) {
std::swap(m_size, wt.m_size);
m_bl.swap(wt.m_bl);
m_bf.swap(wt.m_bf);
m_wt.swap(wt.m_wt);
m_bl_rank.swap(wt.m_bl_rank);
m_bl_rank.set_vector(&m_bl);
wt.m_bl_rank.set_vector(&(wt.m_bl));
m_bf_rank.swap(wt.m_bf_rank);
m_bf_rank.set_vector(&m_bf);
wt.m_bf_rank.set_vector(&(wt.m_bf));
m_bl_select.swap(wt.m_bl_select);
m_bl_select.set_vector(&m_bl);
wt.m_bl_select.set_vector(&(wt.m_bl));
m_bf_select.swap(wt.m_bf_select);
m_bf_select.set_vector(&m_bf);
wt.m_bf_select.set_vector(&(wt.m_bf));
m_C.swap(wt.m_C);
m_C_bf_rank.swap(wt.m_C_bf_rank);
}
}
开发者ID:tb37,项目名称:sdsl-lite,代码行数:26,代码来源:wt_int_rlmn.hpp
示例2: load
//! Loads the data structure from the given istream.
void load(std::istream& in) {
read_member(m_size, in);
m_bl.load(in);
m_bf.load(in);
m_wt.load(in);
m_bl_rank.load(in, &m_bl);
m_bf_rank.load(in, &m_bf);
m_bl_select.load(in, &m_bl);
m_bf_select.load(in, &m_bf);
m_C.load(in);
m_C_bf_rank.load(in);
}
开发者ID:tb37,项目名称:sdsl-lite,代码行数:13,代码来源:wt_int_rlmn.hpp
示例3: serialize
//! Serializes the data structure into the given ostream
size_type serialize(std::ostream& out, structure_tree_node* v=nullptr, std::string name="")const {
structure_tree_node* child = structure_tree::add_child(v, name, util::class_name(*this));
size_type written_bytes = 0;
written_bytes += write_member(m_size, out, child, "size");
written_bytes += m_bl.serialize(out, child, "bl");
written_bytes += m_bf.serialize(out, child, "bf");
written_bytes += m_wt.serialize(out, child, "wt");
written_bytes += m_bl_rank.serialize(out, child, "bl_rank");
written_bytes += m_bf_rank.serialize(out, child, "bf_rank");
written_bytes += m_bl_select.serialize(out, child, "bl_select");
written_bytes += m_bf_select.serialize(out, child, "bf_select");
written_bytes += m_C.serialize(out, child, "C");
written_bytes += m_C_bf_rank.serialize(out, child, "C_bf_rank");
structure_tree::add_size(child, written_bytes);
return written_bytes;
}
开发者ID:tb37,项目名称:sdsl-lite,代码行数:17,代码来源:wt_int_rlmn.hpp
示例4: swap
//! Swap operator
void swap(int_alphabet& strat) {
m_char.swap(strat.m_char);
util::swap_support(m_char_rank, strat.m_char_rank, &m_char, &(strat.m_char));
util::swap_support(m_char_select, strat.m_char_select, &m_char, &(strat.m_char));
m_C.swap(strat.m_C);
std::swap(m_sigma,strat.m_sigma);
}
开发者ID:Alienfeel,项目名称:sdsl-lite,代码行数:8,代码来源:csa_alphabet_strategy.hpp
示例5: load
void load(std::istream& in) {
m_bv.load(in);
m_bv_select1.load(in);
m_bv_select1.set_vector(&m_bv);
m_bv_select0.load(in);
m_bv_select0.set_vector(&m_bv);
}
开发者ID:Tillyard,项目名称:sdsl-lite,代码行数:7,代码来源:louds_tree.hpp
示例6: swap
//! Swap operator
void swap(succinct_byte_alphabet_strategy& strat){
m_char.swap(strat.m_char);
util::swap_support(m_char_rank, strat.m_char_rank, &m_char, &(strat.m_char) );
util::swap_support(m_char_select, strat.m_char_select, &m_char, &(strat.m_char) );
m_C.swap(strat.m_C);
std::swap(m_sigma,strat.m_sigma);
}
开发者ID:bojifengyu,项目名称:RoSA,代码行数:8,代码来源:csa_alphabet_strategy.hpp
示例7: serialize
size_type serialize(std::ostream& out, structure_tree_node* v=nullptr, std::string name="")const {
structure_tree_node* child = structure_tree::add_child(v, name, util::class_name(*this));
size_type written_bytes = 0;
m_bv.serialize(out, child, "bitvector");
m_bv_select1(out, child, "select1");
m_bv_select0(out, child, "select0");
structure_tree::add_size(child, written_bytes);
return written_bytes;
}
开发者ID:Tillyard,项目名称:sdsl-lite,代码行数:9,代码来源:louds_tree.hpp
示例8: load
//! Load method
void load(std::istream& in) {
m_char.load(in);
m_char_rank.load(in);
m_char_rank.set_vector(&m_char);
m_char_select.load(in);
m_char_select.set_vector(&m_char);
m_C.load(in);
read_member(m_sigma, in);
}
开发者ID:Alienfeel,项目名称:sdsl-lite,代码行数:10,代码来源:csa_alphabet_strategy.hpp
示例9: serialize
//! Serialize method
size_type serialize(std::ostream& out, structure_tree_node* v=nullptr, std::string name="")const {
structure_tree_node* child = structure_tree::add_child(v, name, util::class_name(*this));
size_type written_bytes = 0;
written_bytes += m_char.serialize(out, child, "m_char");
written_bytes += m_char_rank.serialize(out, child, "m_char_rank");
written_bytes += m_char_select.serialize(out, child, "m_char_select");
written_bytes += m_C.serialize(out, child, "m_C");
written_bytes += write_member(m_sigma, out, child, "m_sigma");
structure_tree::add_size(child, written_bytes);
return written_bytes;
}
开发者ID:Alienfeel,项目名称:sdsl-lite,代码行数:12,代码来源:csa_alphabet_strategy.hpp
示例10: rank
/*! \param i Argument for the length of the prefix v[0..i-1], with \f$0\leq i \leq size()\f$.
\returns Number of 1-bits in the prefix [0..i-1] of the original bit_vector.
\par Time complexity
\f$ \Order{ sample\_rate of the rrr\_vector} \f$
*/
const size_type rank(size_type i)const {
assert(m_v != nullptr);
assert(i <= m_v->size());
size_type bt_idx = i/t_bs;
size_type sample_pos = bt_idx/t_k;
size_type btnrp = m_v->m_btnrp[ sample_pos ];
size_type rank = m_v->m_rank[ sample_pos ];
if (sample_pos+1 < m_v->m_rank.size()) {
size_type diff_rank = m_v->m_rank[ sample_pos+1 ] - rank;
#ifndef RRR_NO_OPT
if (diff_rank == (size_type)0) {
return rank_support_rrr_trait<t_b>::adjust_rank(rank, i);
} else if (diff_rank == (size_type)t_bs*t_k) {
return rank_support_rrr_trait<t_b>::adjust_rank(
rank + i - sample_pos*t_k*t_bs, i);
}
#endif
}
const bool inv = m_v->m_invert[ sample_pos ];
for (size_type j = sample_pos*t_k; j < bt_idx; ++j) {
uint16_t r = m_v->m_bt[j];
rank += (inv ? t_bs - r: r);
btnrp += rrr_helper_type::space_for_bt(r);
}
uint16_t off = i % t_bs;
if (!off) { // needed for special case: if i=size() is a multiple of t_bs
// the access to m_bt would cause a invalid memory access
return rank_support_rrr_trait<t_b>::adjust_rank(rank, i);
}
uint16_t bt = inv ? t_bs - m_v->m_bt[ bt_idx ] : m_v->m_bt[ bt_idx ];
uint16_t btnrlen = rrr_helper_type::space_for_bt(bt);
number_type btnr = rrr_helper_type::decode_btnr(m_v->m_btnr, btnrp, btnrlen);
uint16_t popcnt = rrr_helper_type::decode_popcount(bt, btnr, off);
return rank_support_rrr_trait<t_b>::adjust_rank(rank + popcnt, i);
}
开发者ID:Alienfeel,项目名称:sdsl-lite,代码行数:41,代码来源:rrr_vector.hpp
示例11: size
const size_type size()const {
return m_v->size();
}
开发者ID:pombredanne,项目名称:RoSA,代码行数:3,代码来源:gap_vector.hpp
示例12: swap
void swap(louds_tree& tree) {
m_bv.swap(tree.m_bv);
util::swap_support(m_bv_select1, tree.m_select1, &m_bv, &(tree.m_bv));
util::swap_support(m_bv_select0, tree.m_select0, &m_bv, &(tree.m_bv));
}
开发者ID:Tillyard,项目名称:sdsl-lite,代码行数:5,代码来源:louds_tree.hpp
示例13: is_leaf
/*! \param v A node.
*/
bool is_leaf(const node_type& v) const {
// node is the last leaf or has no children, so m_bv[v.pos]==1
return (v.pos+1 == m_bv.size()) or m_bv[v.pos+1];
}
开发者ID:Tillyard,项目名称:sdsl-lite,代码行数:6,代码来源:louds_tree.hpp
示例14: nodes
//! Returns the number of nodes in the tree.
size_type nodes()const {
return (m_bv.size()+1)/2;
}
开发者ID:Tillyard,项目名称:sdsl-lite,代码行数:4,代码来源:louds_tree.hpp
示例15: nodes
//! Returns the number of nodes in the tree.
size_type nodes()const {
return m_bv.size()+1/2;
}
开发者ID:chenlonggang,项目名称:sdsl-lite,代码行数:4,代码来源:louds_tree.hpp
注:本文中的bit_vector_type类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论