本文整理汇总了C++中boost::dynamic_bitset::size方法的典型用法代码示例。如果您正苦于以下问题:C++ dynamic_bitset::size方法的具体用法?C++ dynamic_bitset::size怎么用?C++ dynamic_bitset::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::dynamic_bitset
的用法示例。
在下文中一共展示了dynamic_bitset::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_row_shown
void list_view::set_row_shown(const boost::dynamic_bitset<>& shown)
{
assert(generator_);
assert(shown.size() == get_item_count());
window* window = get_window();
assert(window);
const int selected_row = get_selected_row();
bool resize_needed = false;
{
window::invalidate_layout_blocker invalidate_layout_blocker(*window);
for(size_t i = 0; i < shown.size(); ++i) {
generator_->set_item_shown(i, shown[i]);
}
generator_->place(generator_->get_origin(),
generator_->calculate_best_size());
// resize_needed = !content_resize_request();
}
if(resize_needed) {
window->invalidate_layout();
} else {
// content_grid_->set_visible_rectangle(content_visible_rectangle());
set_is_dirty(true);
}
if(selected_row != get_selected_row()) {
fire(event::NOTIFY_MODIFIED, *this, nullptr);
}
}
示例2: 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();
}
示例3: getBitmap
const bool PartialPage::getBitmap(const unsigned long sequence) const
{
if (sequence > bitmap.size()) {
return false;
}
return (bitmap[sequence] == 1);
}
示例4: 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();
}
示例5:
void
DigitalInputWriter::setDigitalInput(const ::boost::dynamic_bitset<>& bitset)
{
for (::std::size_t i = 0; i < bitset.size(); ++i)
{
this->setDigitalInput(i, bitset[i]);
}
}
示例6: bitset_to_vector
void bitset_to_vector( binary_truth_table::cube_type& vec, const boost::dynamic_bitset<> number )
{
vec.clear();
for ( unsigned i = 0u; i < number.size(); ++i )
{
vec.push_back( number.test( i ) );
}
}
示例7: setBitmap
const bool PartialPage::setBitmap(const unsigned long sequence)
{
if (sequence > bitmap.size()) {
return false;
}
bitmap[sequence] = 1;
return true;
}
示例8: v
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;
}
示例9: decrement
void decrement(boost::dynamic_bitset<> &bitset)
{
for (unsigned loop = 0; loop < bitset.size(); ++loop)
{
if ((bitset[loop] ^= 0x1) == 0x0)
{
break;
}
}
}
示例10: serialize
void serialize(output_archive& ar,
boost::dynamic_bitset<Block, Alloc> const& bs, unsigned)
{
std::size_t num_bits = bs.size();
std::vector<Block> blocks(bs.num_blocks());
boost::to_block_range(bs, blocks.begin());
ar << num_bits;
ar << blocks;
}
示例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);
}
}
示例12:
//
// Derive index code from a bitset, that is, return a vector of all indices
// that are set in the bitset
//
std::vector<int> index_code(const boost::dynamic_bitset<>& b)
{
std::vector<int> v;
v.reserve(b.count());
for (int i=0; i<int(b.size()); ++i) {
if (b.test(i)) { //if (b[i] == 1)
v.push_back(i);
}
}
return v;
}
示例13: if
bool executive::ReconvergenceTFGen6::eval_Bra(executive::CTAContext &context,
const ir::PTXInstruction &instr,
const boost::dynamic_bitset<> & branch,
const boost::dynamic_bitset<> & fallthrough) {
report("eval_Bra([PC " << context.PC << "])");
// handle nops
if (!context.active.count()) {
context.PC++;
return false;
}
for (unsigned int id = 0, end = branch.size(); id != end; ++id) {
if (branch[id]) {
threadPCs[id] = instr.branchTargetInstruction;
}
}
for (unsigned int id = 0, end = fallthrough.size(); id != end; ++id) {
if (fallthrough[id]) {
++threadPCs[id];
}
}
bool divergent = true;
if (branch.count() == branch.size()) {
context.PC = instr.branchTargetInstruction;
divergent = false;
}
else if (fallthrough.count() == fallthrough.size()) {
++context.PC;
divergent = false;
}
else {
context.PC = instr.reconvergeInstruction;
}
return divergent;
}
示例14: removeDeadInstructions
void removeDeadInstructions(Trace* trace, const boost::dynamic_bitset<>& live) {
auto &blocks = trace->getBlocks();
for (auto it = blocks.begin(), end = blocks.end(); it != end;) {
auto cur = it; ++it;
Block* block = *cur;
block->remove_if([&] (const IRInstruction& inst) {
assert(inst.getIId() < live.size());
return !live.test(inst.getIId());
});
if (block->empty()) blocks.erase(cur);
}
}
示例15: 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);
}
}