本文整理汇总了C++中boost::dynamic_bitset类的典型用法代码示例。如果您正苦于以下问题:C++ dynamic_bitset类的具体用法?C++ dynamic_bitset怎么用?C++ dynamic_bitset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了dynamic_bitset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: select_options
void multimenu_button::select_options(boost::dynamic_bitset<> states)
{
assert(states.size() == values_.size());
toggle_states_ = states;
update_config_from_toggle_states();
update_label();
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:7,代码来源:multimenu_button.cpp
示例2: operator
void operator()( space_type & ss, boost::dynamic_bitset<> & indices, result_type column_margin, result_type row_margin ) {
typedef typename space_type::raw_block_pointer iterator;
size_type N = ss.row_count();
size_type i = 0;
while ( i < N ) {
if( !indices.test(i) ) {
++i;
continue;
}
iterator start = ss.begin_row(i);
iterator end = ss.end_row(i);
size_type j = 0, M = 0;
while( start != end ) {
block_type b = *start++;
while( b ) {
unsigned int b_idx = bit_walker_type::unset_next_index( b ) + j;
column_margin[ b_idx ] += 1;
++M;
}
j += bit_helper_type::BITS_PER_BLOCK;
}
row_margin[ i ] = M;
++i;
}
}
开发者ID:putnampp,项目名称:clotho,代码行数:30,代码来源:row_grouped_frequency_evaluator.hpp
示例3: normalize_split
void normalize_split( boost::dynamic_bitset<>& split, const vector< vector< int > >& splitmap, int target_size ){
boost::dynamic_bitset<> newsplit( target_size );
for( int i=0; i<splitmap.size(); i++ )
for(int j=0; j<splitmap[i].size(); j++)
newsplit.set( splitmap[i][j], split.test(i) );
split = newsplit;
}
开发者ID:ryneches,项目名称:PhyloSift,代码行数:7,代码来源:readconciler.cpp
示例4:
void
DigitalInputWriter::setDigitalInput(const ::boost::dynamic_bitset<>& bitset)
{
for (::std::size_t i = 0; i < bitset.size(); ++i)
{
this->setDigitalInput(i, bitset[i]);
}
}
开发者ID:roboticslibrary,项目名称:rl,代码行数:8,代码来源:DigitalInputWriter.cpp
示例5: checkKmers
void
checkKmers(DnaString const & kmer,
TVertexDescriptor const & starting_vertex,
TVertexDescriptor const & source_vertex,
TGraph const & graph,
std::vector<VertexLabels> & vertex_vector,
boost::unordered_set<TVertexDescriptor> const & free_nodes,
boost::unordered_map< std::pair<TVertexDescriptor, TVertexDescriptor>, boost::dynamic_bitset<> > & edge_ids,
boost::dynamic_bitset<> const & id_bits,
TKmerMap & kmer_map,
std::size_t const & kmer_size
)
{
if (id_bits.none())
return;
if (length(kmer) == kmer_size)
{
KmerLabels new_kmer_label =
{
starting_vertex,
source_vertex,
id_bits
};
if (kmer_map.count(kmer) == 0)
{
std::vector<KmerLabels> new_vector(1, new_kmer_label);
kmer_map[kmer] = new_vector;
}
else
{
kmer_map[kmer].push_back(new_kmer_label);
}
return;
}
for (Iterator<TGraph, OutEdgeIterator>::Type out_edge_iterator (graph, source_vertex) ; !atEnd(out_edge_iterator) ; ++out_edge_iterator)
{
DnaString new_kmer(kmer);
TVertexDescriptor const & target_vertex = targetVertex(out_edge_iterator);
boost::dynamic_bitset<> new_id_bits(id_bits);
if (free_nodes.count(target_vertex) == 0)
{
seqan::appendValue(new_kmer, vertex_vector[target_vertex].dna);
std::pair<TVertexDescriptor, TVertexDescriptor> edge_pair(source_vertex, target_vertex);
if (edge_ids.count(edge_pair) == 1)
{
new_id_bits = id_bits & edge_ids[edge_pair];
}
}
checkKmers(new_kmer, starting_vertex, target_vertex, graph, vertex_vector, free_nodes, edge_ids, new_id_bits, kmer_map, kmer_size);
}
}
开发者ID:gyper,项目名称:gyper,代码行数:58,代码来源:graph_kmerify.cpp
示例6: cliqueHelper3
unsigned int cliqueHelper3(const boost_graph &g, const std::vector<VertexID> &nodes, const std::vector<EdgeID> &edges, double &score)
{
static boost::dynamic_bitset<> empty;
empty.resize(nodes.size());
unsigned largest_clique = 1;
boost::dynamic_bitset<> set(nodes.size());
for (unsigned i = 0; i < nodes.size(); ++i)
{
set[i] = true;
}
int i = 0;
while ((largest_clique <= 1 || i < 50000) && i < 100000)
{
// build the next potential clique.
// every bit that is a 1 in set means that that node is in the clique.
std::vector<VertexID> clique;
randomize(set);
set[0] = true; // the first bit is the query node. must always be on.
for (unsigned loop = 0; loop < nodes.size(); ++loop)
{
if (set[loop])
{
clique.push_back(nodes[loop]);
}
}
// if this is a clique..
double maybe_score = 0;
if ((clique.size() > largest_clique) && isClique(g, clique, edges, maybe_score))
{
largest_clique = clique.size();
score = maybe_score;
std::cout << "Largest clique is " << largest_clique << std::endl;
}
//decrement(set);
//increment(set);
i++;
}
return largest_clique;
}
开发者ID:ChrisWhiten,项目名称:VideoParser,代码行数:45,代码来源:ObjectRecognizer.cpp
示例7: bitset_to_vector
template<class T> std::vector<T>
bitset_to_vector(const boost::dynamic_bitset<>& b)
{
std::vector<T> v(b.size());
for (size_t i=0; i<v.size(); ++i) {
if (b[i])
v[i] = 1;
}
return v;
}
开发者ID:rpahl,项目名称:permory,代码行数:10,代码来源:vector.hpp
示例8: decrement
void decrement(boost::dynamic_bitset<> &bitset)
{
for (unsigned loop = 0; loop < bitset.size(); ++loop)
{
if ((bitset[loop] ^= 0x1) == 0x0)
{
break;
}
}
}
开发者ID:ChrisWhiten,项目名称:VideoParser,代码行数:10,代码来源:ObjectRecognizer.cpp
示例9: format_binary
std::string format_binary(const boost::dynamic_bitset<>& b) {
std::ostringstream oss;
oss.imbue(std::locale::classic());
oss.put('"');
oss << std::hex << std::setw(1);
unsigned c = b.size();
unsigned n = (4 - (c % 4)) & 3;
oss << n;
for (unsigned i = 0; i < c + n;) {
unsigned accum = 0;
for (int j = 0; j < 4; ++j, ++i) {
unsigned bit = i < n ? 0 : b.test(c - i + n - 1) ? 1 : 0;
accum |= bit << (3-j);
}
oss << accum;
}
oss.put('"');
return oss.str();
}
开发者ID:jf---,项目名称:IfcOpenShell,代码行数:19,代码来源:IfcWrite.cpp
示例10:
template<typename PointT, typename NormalT> bool
pcl::NormalSpaceSampling<PointT, NormalT>::isEntireBinSampled (boost::dynamic_bitset<> &array, unsigned int start_index, unsigned int length)
{
bool status = true;
for (unsigned int i = start_index; i < start_index + length; i++)
{
status = status & array.test (i);
}
return status;
}
开发者ID:MorS25,项目名称:pcl-fuerte,代码行数:10,代码来源:normal_space.hpp
示例11: set_row_shown
void listbox::set_row_shown(const boost::dynamic_bitset<>& shown)
{
assert(generator_);
assert(shown.size() == get_item_count());
if(generator_->get_items_shown() == shown) {
LOG_GUI_G << LOG_HEADER << " returning early" << std::endl;
return;
}
window* window = get_window();
assert(window);
const int selected_row = get_selected_row();
bool resize_needed = false;
// Local scope for invalidate_layout_blocker
{
window::invalidate_layout_blocker invalidate_layout_blocker(*window);
for(size_t i = 0; i < shown.size(); ++i) {
generator_->set_item_shown(i, shown[i]);
}
point best_size = generator_->calculate_best_size();
generator_->place(generator_->get_origin(), {std::max(best_size.x, content_visible_area().w), best_size.y});
resize_needed = !content_resize_request();
}
if(resize_needed) {
window->invalidate_layout();
} else {
content_grid_->set_visible_rectangle(content_visible_area());
set_is_dirty(true);
}
if(selected_row != get_selected_row()) {
fire(event::NOTIFY_MODIFIED, *this, nullptr);
}
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:42,代码来源:listbox.cpp
示例12: particlesDeleted
/******************************************************************************
* Remaps the bonds after some of the particles have been deleted.
* Dangling bonds are removed too.
******************************************************************************/
void BondsObject::particlesDeleted(const boost::dynamic_bitset<>& deletedParticlesMask)
{
// Build map that maps old particle indices to new indices.
std::vector<size_t> indexMap(deletedParticlesMask.size());
auto index = indexMap.begin();
size_t oldParticleCount = deletedParticlesMask.size();
size_t newParticleCount = 0;
for(size_t i = 0; i < deletedParticlesMask.size(); i++)
*index++ = deletedParticlesMask.test(i) ? std::numeric_limits<size_t>::max() : newParticleCount++;
auto result = modifiableStorage()->begin();
auto bond = modifiableStorage()->begin();
auto last = modifiableStorage()->end();
for(; bond != last; ++bond) {
// Remove invalid bonds.
if(bond->index1 >= oldParticleCount || bond->index2 >= oldParticleCount)
continue;
// Remove dangling bonds whose particles have gone.
if(deletedParticlesMask.test(bond->index1) || deletedParticlesMask.test(bond->index2))
continue;
// Keep but remap particle indices.
result->pbcShift = bond->pbcShift;
result->index1 = indexMap[bond->index1];
result->index2 = indexMap[bond->index2];
++result;
}
modifiableStorage()->erase(result, last);
changed();
}
开发者ID:taohonker,项目名称:Ovito,代码行数:35,代码来源:BondsObject.cpp
示例13: select_layers
void stacked_widget::select_layers(const boost::dynamic_bitset<>& mask)
{
assert(mask.size() == get_layer_count());
select_layer_impl([&](unsigned int i)
{
if(mask[i]) {
update_selected_layer_index(i);
}
return mask[i];
});
}
开发者ID:GregoryLundberg,项目名称:wesnoth,代码行数:13,代码来源:stacked_widget.cpp
示例14: set_row_shown
void tlistbox::set_row_shown(const boost::dynamic_bitset<>& shown)
{
assert(generator_);
assert(shown.size() == get_item_count());
if (generator_->get_items_shown() == shown)
{
LOG_GUI_G << LOG_HEADER << " returning early" << std::endl;
return;
}
twindow* window = get_window();
assert(window);
const int selected_row = get_selected_row();
bool resize_needed;
{
twindow::tinvalidate_layout_blocker invalidate_layout_blocker(*window);
for(size_t i = 0; i < shown.size(); ++i) {
generator_->set_item_shown(i, shown[i]);
}
tpoint best_size = generator_->calculate_best_size();
generator_->place(generator_->get_origin(), { std::max(best_size.x, content_visible_area().w), best_size.y });
resize_needed = !content_resize_request();
}
if(resize_needed) {
window->invalidate_layout();
} else {
content_grid_->set_visible_rectangle(content_visible_area());
set_is_dirty(true);
}
if(selected_row != get_selected_row() && callback_value_changed_) {
callback_value_changed_(*this);
}
}
开发者ID:shikadilord,项目名称:wesnoth,代码行数:39,代码来源:listbox.cpp
示例15: setLinkVisibilities
void EditableSceneBody::setLinkVisibilities(const boost::dynamic_bitset<>& visibilities)
{
int i;
const int m = numSceneLinks();
const int n = std::min(m, (int)visibilities.size());
for(i=0; i < n; ++i){
sceneLink(i)->setVisible(visibilities[i]);
}
while(i < m){
sceneLink(i)->setVisible(false);
++i;
}
notifyUpdate(impl->modified);
}
开发者ID:orikuma,项目名称:choreonoid,代码行数:14,代码来源:EditableSceneBody.cpp
示例16: remove_local_destinations
// Returns true if at least one destination has been retained, i.e. one
// destination is remote. It returns false if all destinations have been
// local.
inline std::vector<naming::gid_type>::iterator
remove_local_destinations(std::vector<naming::gid_type>& gids,
std::vector<naming::address>& addrs,
boost::dynamic_bitset<> const& locals)
{
HPX_ASSERT(gids.size() == addrs.size());
std::vector<naming::gid_type>::iterator gids_it = gids.begin();
std::vector<naming::gid_type>::iterator gids_end = gids.end();
std::vector<naming::address>::iterator addrs_it = addrs.begin();
// gids_it = find_if(gids_it, gids_end, pred)
std::size_t i = 0;
for (/**/; gids_it != gids_end; ++gids_it, ++addrs_it)
{
if (locals.test(i++))
break;
}
if (gids_it == gids_end)
return gids_it;
// gids_next = remove_if(gids_it, gids_end, pred)
std::vector<naming::gid_type>::iterator gids_next = gids_it;
std::vector<naming::address>::iterator addrs_next = addrs_it;
for (++gids_it, ++addrs_it; gids_it != gids_end; ++gids_it, ++addrs_it)
{
if (!locals.test(i++))
{
*gids_next++ = std::move(*gids_it);
*addrs_next++ = std::move(*addrs_it);
}
}
return gids_next;
}
开发者ID:41i,项目名称:hpx,代码行数:39,代码来源:remove_local_destinations.hpp
示例17: randomize
void randomize(boost::dynamic_bitset<> &bitset)
{
for (unsigned loop = 0; loop < bitset.size(); ++loop)
{
double rand_num = (double)rand()/RAND_MAX;
if (rand_num < 0.1)
{
bitset[loop] = true;
}
else
{
bitset[loop] = false;
}
}
}
开发者ID:ChrisWhiten,项目名称:VideoParser,代码行数:16,代码来源:ObjectRecognizer.cpp
示例18: init_migrate_done_set
void table_manager::init_migrate_done_set(boost::dynamic_bitset<> &migrate_done_set, const vector<uint64_t> ¤t_state_table)
{
int bucket_number = 0;
for (size_t i=0; i<current_state_table.size(); i+=this->copy_count) {
bucket_number = (int)current_state_table[i++]; // skip the bucket_number
bool has_migrated = false;
for (size_t j=0; j<this->copy_count; ++j) {
if (current_state_table[i+j] != server_table[bucket_number + j * this->bucket_count]) {
has_migrated = true;
break;
}
}
if (has_migrated) {
migrate_done_set.set(bucket_number, true);
log_debug("bucket[%d] has migrated");
}
}
}
开发者ID:IsCaster,项目名称:tair-rdb,代码行数:18,代码来源:table_manager.cpp
示例19: branchContext
bool executive::ReconvergenceBarrier::eval_Bra(executive::CTAContext &context,
const ir::PTXInstruction &instr,
const boost::dynamic_bitset<> & branch,
const boost::dynamic_bitset<> & fallthrough) {
bool isDivergent = false;
if (instr.uni) {
// unfiorm
if (branch.count()) {
// all threads branch
context.PC = instr.branchTargetInstruction;
}
else {
// all threads fall through
context.PC ++;
}
}
else {
// divergence - complicated
CTAContext branchContext(context), fallthroughContext(context);
branchContext.active = branch;
branchContext.PC = instr.branchTargetInstruction;
fallthroughContext.active = fallthrough;
fallthroughContext.PC++;
runtimeStack.pop_back();
if (branchContext.active.any()) {
runtimeStack.push_back(branchContext);
}
if (fallthroughContext.active.any()) {
runtimeStack.push_back(fallthroughContext);
}
isDivergent = true;
}
return isDivergent;
}
开发者ID:AlexanderStohr,项目名称:gpuocelot,代码行数:43,代码来源:ReconvergenceMechanism.cpp
示例20: notCandidates
/*
* Finds the set of SSATmps that should be considered for allocation
* to a full XMM register. These are the SSATmps that satisfy all the
* following conditions:
* a) it requires 2 64-bit registers
* b) it's defined in a load instruction
* c) all its uses are simple stores to memory
*
* The computed set of SSATmps is stored in m_fullXMMCandidates.
*/
void LinearScan::findFullXMMCandidates() {
boost::dynamic_bitset<> notCandidates(m_irFactory->numTmps());
m_fullXMMCandidates.reset();
for (auto* block : m_blocks) {
for (auto& inst : *block) {
for (SSATmp& tmp : inst.dsts()) {
if (tmp.numNeededRegs() == 2 && inst.isLoad()) {
m_fullXMMCandidates[tmp.id()] = true;
}
}
int idx = 0;
for (SSATmp* tmp : inst.srcs()) {
if (tmp->numNeededRegs() == 2 && !inst.storesCell(idx)) {
notCandidates[tmp->id()] = true;
}
idx++;
}
}
}
m_fullXMMCandidates -= notCandidates;
}
开发者ID:jacano1969,项目名称:hiphop-php,代码行数:31,代码来源:linear-scan.cpp
注:本文中的boost::dynamic_bitset类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论