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


C++ BitSet::add方法代码示例

本文整理汇总了C++中BitSet::add方法的典型用法代码示例。如果您正苦于以下问题:C++ BitSet::add方法的具体用法?C++ BitSet::add怎么用?C++ BitSet::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitSet的用法示例。


在下文中一共展示了BitSet::add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

BitSet BitSet::operator<<(const int shift)
{
    BitSet result;
    for (int i = 0; i < shift; ++i) {
        result.add(false);
    }
    for (int i = 0; i < this->length(); ++i) {
        result.add((*this)[i]);
    }
    return result;
}
开发者ID:vlad-shevchenko,项目名称:BitSet,代码行数:11,代码来源:bitset.cpp

示例2: propagate_no_ub

/*
 * Restricted propagation procedure. Used when a direction is solved, but no new q-intersection is found.
 * Same as propagate, except that upper bounds are not recorded (because we did not find a curr_qinter to work with).
 */
void propagate_no_ub(const Array<IntervalVector>& boxes, IntStack ***dirboxes, int dimension, bool left, IntervalVector& hull_qinter, vector<BitSet *>& nogoods) {
	
	unsigned int n = hull_qinter.size();
	unsigned int p = boxes.size();
	
	IntervalVector b(n);
	
	/* Create the new nogood */
	BitSet *newNogood = new BitSet(0,p-1,BitSet::empt);
	
	/* We iterate through the boxes to propagate bounds */
	/* This does not seem to be optimal ; maybe we should study directly the directions' lists ? */
	for (int i=0; i<p; i++) {
		b = boxes[i];
		
		/* Check if the box can be added to the new nogood */
		if ((left && (b[dimension].lb() < hull_qinter[dimension].lb())) || (!left && (b[dimension].ub() > hull_qinter[dimension].ub()))) {
			newNogood->add(i);	
		}
		
		/* Check if the box is strictly outside our current q-inter hull */
		if ((left && (b[dimension].ub() < hull_qinter[dimension].lb())) || (!left && (b[dimension].lb() > hull_qinter[dimension].ub()))) {
			for (int k=dimension+1; k<n; k++) {
				if (dirboxes[k][0]->contain(i)) dirboxes[k][0]->remove(i);
				if (dirboxes[k][1]->contain(i)) dirboxes[k][1]->remove(i);
			}
			
			continue;
		}
	}
	
	nogoods.push_back(newNogood);
}
开发者ID:jinxiaosa,项目名称:ibex-lib,代码行数:37,代码来源:ibex_QInter2.cpp

示例3: propagate

/* 
 * Bound propagation and nogood recording. Assumes that dimensions are processed in the ascending order and left side first.
 */
void propagate(const Array<IntervalVector>& boxes, IntStack ***dirboxes, int dimension, bool left, IntervalVector& curr_qinter, vector<BitSet *>& nogoods) {
	
	unsigned int n = curr_qinter.size();
	unsigned int p = boxes.size();
	
	IntervalVector b(n);
	
	/* Create the new nogood */
	BitSet *newNogood = new BitSet(0,p-1,BitSet::empt);
	
	/* We iterate through the boxes to propagate bounds */
	/* This does not seem to be optimal ; maybe we should study directly the directions' lists ? */
	for (int i=0; i<p; i++) {
		b = boxes[i];
		
		/* Check if the box can be added to the new nogood */
		if ((left && (b[dimension].lb() < curr_qinter[dimension].lb())) || (!left && (b[dimension].ub() > curr_qinter[dimension].ub()))) {
			newNogood->add(i);	
		}
		
		/* First check : the q-inter is a valid upper bound for the opposite direction */
		if (left && (b[dimension].ub() <= curr_qinter[dimension].ub())) {
			if (dirboxes[dimension][1]->contain(i)) dirboxes[dimension][1]->remove(i);
		}
		
		/* Second check : check if the box is strictly outside our current q-inter hull */
		if ((left && (b[dimension].ub() < curr_qinter[dimension].lb())) || (!left && (b[dimension].lb() > curr_qinter[dimension].ub()))) {
			for (int k=dimension+1; k<n; k++) {
				if (dirboxes[k][0]->contain(i)) dirboxes[k][0]->remove(i);
				if (dirboxes[k][1]->contain(i)) dirboxes[k][1]->remove(i);
			}
			
			continue;
		}
		
		/* Third check : the q-intersection provides a valid upper bound for the orthogonal dimensions. */
		for (int j=dimension+1; j<n; j++) {
			if (b[j].lb() >= curr_qinter[j].lb()) {
				if (dirboxes[j][0]->contain(i)) dirboxes[j][0]->remove(i);
			}
			if (b[j].ub() <= curr_qinter[j].ub()) {
				if (dirboxes[j][1]->contain(i)) dirboxes[j][1]->remove(i);
			}
		}
	}
	
	nogoods.push_back(newNogood);
}
开发者ID:jinxiaosa,项目名称:ibex-lib,代码行数:51,代码来源:ibex_QInter2.cpp

示例4: BitSet

	BitSet *gen(BasicBlock *bb) {
		BitSet *result = new BitSet(size);
		result->add(bb->number());
		return result;
	}
开发者ID:alexjordan,项目名称:otawa,代码行数:5,代码来源:util_PostDominance.cpp


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