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


C++ dynamic_bitset::size方法代码示例

本文整理汇总了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);
	}
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:33,代码来源:list.cpp

示例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();
}
开发者ID:taohonker,项目名称:Ovito,代码行数:35,代码来源:BondsObject.cpp

示例3: getBitmap

const bool PartialPage::getBitmap(const unsigned long sequence) const
{
	if (sequence > bitmap.size()) {
		return false;
	}
	return (bitmap[sequence] == 1);
}
开发者ID:mcmenaminadrian,项目名称:variload,代码行数:7,代码来源:pages.cpp

示例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();
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:7,代码来源:multimenu_button.cpp

示例5:

		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

示例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 ) );
   }
 }
开发者ID:sterin,项目名称:cirkit,代码行数:8,代码来源:circuit_to_truth_table.cpp

示例7: setBitmap

const bool PartialPage::setBitmap(const unsigned long sequence)
{
	if (sequence > bitmap.size()) {
		return false;
	}
	bitmap[sequence] = 1;
	return true;
}
开发者ID:mcmenaminadrian,项目名称:variload,代码行数:8,代码来源:pages.cpp

示例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;
}
开发者ID:rpahl,项目名称:permory,代码行数:10,代码来源:vector.hpp

示例9: 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

示例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;
    }
开发者ID:ShmuelLevine,项目名称:hpx,代码行数:10,代码来源:dynamic_bitset.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:

 //
 // 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;
 }
开发者ID:rpahl,项目名称:permory,代码行数:15,代码来源:recode.hpp

示例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;
}
开发者ID:AlexanderStohr,项目名称:gpuocelot,代码行数:41,代码来源:ReconvergenceMechanism.cpp

示例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);
  }
}
开发者ID:devmario,项目名称:hiphop-php,代码行数:12,代码来源:dce.cpp

示例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);
	}
}
开发者ID:shikadilord,项目名称:wesnoth,代码行数:39,代码来源:listbox.cpp


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