您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ used函数代码示例

51自学网 2021-06-03 09:22:43
  C++
这篇教程C++ used函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中used函数的典型用法代码示例。如果您正苦于以下问题:C++ used函数的具体用法?C++ used怎么用?C++ used使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: assert

void CBasicBlocksBuilder::SortBlocks(){	assert( blocks.size() > 0 );	std::vector<bool> used( blocks.size(), false );	CBasicBlock currBlock = blocks[labelToBlock[firstLabel->label]];	used[labelToBlock[firstLabel->label]] = true;	sortedBlocks.push_back( currBlock );	const IIRStm* jump = currBlock.Last();	size_t numOfFreeBlocks = used.size() - 1;	while( numOfFreeBlocks > 0 ) {		if( IsInstanceOf<CIRJump>( const_cast< IIRStm* >( jump ) ) ) {			// За ним просто должен идти блок с меткой, куда прыгаем			const Temp::CLabel* nextLabel = getNextLabel( jump );			if( nextLabel->Name() == "done_label" || used[labelToBlock[nextLabel]] ) {				// Если блок конца фрейма, или же след ведет в посещенный блок				// Значит нужно взять непосещенный и с ним строить след				int position = 0;				if( getNextFreeBlock( used, currBlock, position ) ) {					sortedBlocks.push_back( currBlock );					used[position] = true;					--numOfFreeBlocks;					jump = currBlock.Last();					continue;				} else {					// Свободных блоков не осталось					break;				}			}			currBlock = blocks[labelToBlock[nextLabel]];			sortedBlocks.push_back( currBlock );			used[labelToBlock[nextLabel]] = true;			--numOfFreeBlocks;		} else if( IsInstanceOf<CIRCJump>( const_cast< IIRStm* >( jump ) ) ) {			// За ним должен идти блок с меткой на false			const Temp::CLabel* nextLabel = getNextConditionalLabel( jump );			if( nextLabel->Name() == "done_label" || used[labelToBlock[nextLabel]] ) {				int position = 0;				if( getNextFreeBlock( used, currBlock, position ) ) {					sortedBlocks.push_back( currBlock );					used[position] = true;					--numOfFreeBlocks;					jump = currBlock.Last();					continue;				} else {					// Свободных блоков не осталось					break;				}			}			currBlock = blocks[labelToBlock[nextLabel]];			sortedBlocks.push_back( currBlock );			used[labelToBlock[nextLabel]] = true;			--numOfFreeBlocks;		} else {			assert( false );		}		jump = currBlock.Last();	}}
开发者ID:Dimassio,项目名称:rocket3-compiler,代码行数:58,


示例2: outrumor

void outrumor(){    int rn;    int i;    FILE *rumf;    if(n_rumors <= n_used_rumors) {        return;    }    else {        rumf = fopen(RUMORFILE, "r");        if(rumf == NULL) {            return;        }    }    if(n_used_rumors < 0) {        init_rumors(rumf);    }    if(n_rumors == 0) {        fclose(rumf);                return;    }    rn = rn2(n_rumors - n_used_rumors);    i = 0;    while((rn != 0) || (used(i) != 0)) {        skipline(rumf);                if(used(i) == 0) {            --rn;        }        ++i;    }    usedbits[i / CHARSZ] |= (1 << (i % CHARSZ));    ++n_used_rumors;    outline(rumf);    fclose(rumf);}
开发者ID:tcadigan,项目名称:hack_1.0,代码行数:45,


示例3: hd_open

int hd_open(uint8_t minor, uint16_t flag){    used(flag);    if(minor != 0) {        udata.u_error = ENODEV;        return -1;    }    return 0;}
开发者ID:EtchedPixels,项目名称:FUZIX,代码行数:9,


示例4: permuteUniqueSub

vector<vector<int> > permuteUniqueSub(vector<int> &num) {    sort(num.begin(),num.end());//sort the original array.    vector<bool> used(num.size(),false);    vector<int> subans;    vector<vector<int>> ans;    permuteUniqueHelper(num,subans,used,ans);    return ans;    }
开发者ID:charmingpast,项目名称:git_test,代码行数:9,


示例5: canPartitionKSubsets

 bool canPartitionKSubsets(vector<int>& nums, int k) {     int n = nums.size();     vector<bool> used(n, false);     int sum = accumulate(nums.begin(), nums.end(), 0);     if (sum % k != 0) {         return false;     }     return canPartition(nums, used, 0, n, 0, sum / k, k); }
开发者ID:Time1ess,项目名称:MyCodes,代码行数:9,


示例6: assert

void HeapRegion::par_clear() {  assert(used() == 0, "the region should have been already cleared");  assert(capacity() == HeapRegion::GrainBytes, "should be back to normal");  HeapRegionRemSet* hrrs = rem_set();  hrrs->clear();  CardTableModRefBS* ct_bs =                   (CardTableModRefBS*)G1CollectedHeap::heap()->barrier_set();  ct_bs->clear(MemRegion(bottom(), end()));}
开发者ID:BunnyWei,项目名称:truffle-llvmir,代码行数:9,


示例7: totalNQueens

 int totalNQueens(int n) {     if (n < 1)     	return 0;     vector<int> usedRows(n, -1);     vector<vector<bool> > used(n, vector<bool>(n, false));     int num = 0;     findNQueens(0, n, usedRows, used, num);     return num; }
开发者ID:tianyangche,项目名称:leetcode-1,代码行数:9,


示例8: addImage

	void addImage(const DL_ImageData& image)	{		if (used()) {			ImageHandle handle;			handle.handle = m_output->writeImage(m_writer, image, getAttributes());			handle.data = image;			m_images[image.ref] = handle;		}	}
开发者ID:ohm2013,项目名称:gis,代码行数:9,


示例9: used

void Graph::LFRColoring(){    list<int> *adjacentNodes = Graph::adjacentNodes; //inicjalizacja lokalnej listy wezlow    int uncolored=V; //zmienna sluzaca do okreslenia ile wezlow zostalo do pokolorowania    int node; //wezel    for (int u = 0; u<V; u++) {        tmp.push_back(adjacentNodes[u].size()); //lista przechowujaca ilosc sasiadow kazdego z wezlow do pozniejszego wybrania    }    //ustawienie wszystkich wezlow jako niepokolorowane    for (int u = 0; u < V; u++) {        color.push_back(-1);    }    // Tymczasowa tablica sluzaca do ustalenia czy dany kolor    // zostal uzyty do pokolorowania sasiedniego wezla    vector<bool> used(V);    for (int cr = 0; cr < V; cr++)        used[cr] = false;    // glowna petla algorytmu    while (uncolored>0) {        node = getTmp(); //wybor wezla        list<int>::iterator i;        for (i = adjacentNodes[node].begin(); i != adjacentNodes[node].end(); ++i) //iteracja po sasiednich wezlach            if (color[*i] != -1) // czy kolor jest uzyty                used[color[*i]] = true; // zaznacz uzyty kolor        //wybierz pierwszy dostepny kolor        int cr;        for (cr = 0; cr < V; cr++)            if (used[cr] == false)                break;        //przypisz pierwszy wolny kolor do wezla        color[node] = cr;        uncolored--;        // zresetuj wartosci dla kolejnej iteracji        for (i = adjacentNodes[node].begin(); i != adjacentNodes[node].end(); ++i)            if (color[*i] != -1)                used[color[*i]] = false;    }    //wypisz wartosci    for (int u = 0; u < V; u++)        std::cout << "Vertex " << u << " --->  Color "                  << color[u] << std::endl;    //wyczysc listy    tmp.clear();    color.clear();}
开发者ID:Krasherr,项目名称:Graphs,代码行数:57,


示例10: addBlock

	void addBlock(const DL_BlockData& block)	{		m_inBlock = true;		m_blockName = block.name;				if (m_blockMode && used()) {			m_output->writeBlock(m_writer, block);		}	}
开发者ID:ohm2013,项目名称:gis,代码行数:9,


示例11: lpr_open

int lpr_open(uint8_t minor, uint16_t flag){    used(flag);    if (ubee_parallel != UBEE_PARALLEL_LPR || minor) {        udata.u_error = ENODEV;        return -1;    }    return 0;}
开发者ID:EtchedPixels,项目名称:FUZIX,代码行数:9,


示例12: permute

 vector<vector<int>> permute(vector<int>& nums) {     vector<vector<int>> result;     vector<bool> used(nums.size(), false);     vector<int> current;          dfs(nums, used, current, result);          return result; }
开发者ID:pmdiano,项目名称:shuati,代码行数:9,


示例13: permuteUnique

    /**     * @param nums: A list of integers.     * @return: A list of unique permutations.     */    vector<vector<int>> permuteUnique(vector<int> &nums) {        vector<vector<int>> result;        vector<bool> used(nums.size(), false);        vector<int> ans;        sort(nums.begin(), nums.end());        permuteUniqueHelper(nums, &used, &ans, &result);        return result;    }
开发者ID:ZhongminJin,项目名称:LintCode,代码行数:13,


示例14: PermutationSquareNum

vector<string> PermutationSquareNum(int n) {	vector<string> res;	vector<bool> used(n, false);	PermutationSquareNumRe(n, used, -1, 0, "", res);	if(res.empty())		res.push_back("");	return res;}
开发者ID:TigerCS,项目名称:LeetCode,代码行数:9,


示例15: DelegateButton

void UBGraphicsMediaItemDelegate::buildButtons(){    if(!mPlayPauseButton){        mPlayPauseButton = new DelegateButton(":/images/play.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);        connect(mPlayPauseButton, SIGNAL(clicked(bool)),                this, SLOT(togglePlayPause()));        mStopButton = new DelegateButton(":/images/stop.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);        connect(mStopButton, SIGNAL(clicked(bool)),                delegated(), SLOT(stop()));        mMediaControl = new DelegateMediaControl(delegated(), mToolBarItem);        mMediaControl->setFlag(QGraphicsItem::ItemIsSelectable, true);        UBGraphicsItem::assignZValue(mMediaControl, delegated()->zValue());        if (delegated()->isMuted())            mMuteButton = new DelegateButton(":/images/soundOff.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);        else            mMuteButton = new DelegateButton(":/images/soundOn.svg", mDelegated, mToolBarItem, Qt::TitleBarArea);        connect(mMuteButton, SIGNAL(clicked(bool)),                delegated(), SLOT(toggleMute()));        connect(mMuteButton, SIGNAL(clicked(bool)),                this, SLOT(toggleMute())); // for changing button image        mToolBarButtons << mPlayPauseButton << mStopButton << mMuteButton;        mToolBarItem->setItemsOnToolBar(QList<QGraphicsItem*>() << mPlayPauseButton << mStopButton << mMediaControl  << mMuteButton );        mToolBarItem->setVisibleOnBoard(true);        mToolBarItem->setShifting(false);        if (!mToolBarShowTimer) {            if (delegated()->hasLinkedImage()) {                mToolBarShowTimer = new QTimer();                mToolBarShowTimer->setInterval(m_iToolBarShowingInterval);                connect(mToolBarShowTimer, SIGNAL(timeout()), this, SLOT(hideToolBar()));            }        }        else {            connect(mPlayPauseButton, SIGNAL(clicked(bool)),                    mToolBarShowTimer, SLOT(start()));            connect(mStopButton, SIGNAL(clicked(bool)),                    mToolBarShowTimer, SLOT(start()));            connect(mMediaControl, SIGNAL(used()),                    mToolBarShowTimer, SLOT(start()));            connect(mMuteButton, SIGNAL(clicked(bool)),                    mToolBarShowTimer, SLOT(start()));        }        positionHandles();    }
开发者ID:OpenBoard-org,项目名称:OpenBoard,代码行数:56,


示例16: net_write

arg_t net_write(struct socket *s, uint8_t flag){  uint16_t n = 0;  used(s);  used(flag);  while(n < udata.u_count) {    if (sockets[0].s_state == SS_CLOSED) {      udata.u_error = EPIPE;      ssig(udata.u_ptab, SIGPIPE);      return -1;    }    /* FIXME - screen +++ handling ! */    netat_outbyte(ugetc(udata.u_base++));    n++;  }  return udata.u_count;}
开发者ID:aralbrec,项目名称:FUZIX,代码行数:19,


示例17: combinationSum3

 vector<vector<int>> combinationSum3(int k, int n) {     vector<vector<int>> res;     if(n<=0 || n>45)         return res;     vector<int> temp;     vector<bool> used(10,false);     int start = 1;     dfs(k,n,start,temp,used,res);     return res; }
开发者ID:quitz,项目名称:myleetcode,代码行数:10,


示例18: permuteUnique

 vector<vector<int> > permuteUnique(vector<int> &num) {     vector<vector<int> > result;     if (num.empty())         return result;     sort(num.begin(), num.end());     vector<bool> used(num.size(), false);     vector<int> comb;     findPermuteUnique(num, used, comb, result, 0, num.size());     return result; }
开发者ID:tianyangche,项目名称:leetcode-1,代码行数:10,


示例19: used

int BrfData::GetFirstUnusedLetter() const{  vector<bool> used(255,false);  for (unsigned int i=0; i<mesh.size(); i++) {    char let = mesh[i].name[4];    used[let]=true;  }  for (char i='A'; i<'Z'; i++) if (!used[i]) return i-'A';  return -1;}
开发者ID:cfcohen,项目名称:openbrf,代码行数:10,


示例20: blkdev_scan

/* Flags is not used yet but will be needed (eg for swap scans) */void blkdev_scan(blkdev_t *blk, uint8_t flags){    uint8_t letter = 'a' + (blk - blkdev_table);    used(flags); /* not used */    blk_op.blkdev = blk;    mbr_parse(letter);    kputchar('/n');}
开发者ID:willsowerbutts,项目名称:FUZIX,代码行数:11,


示例21: swapvictim

/* *	Swap out process. As we have them all the same size we ignore *	p for now. For a single memory image system most of this can go! */static ptptr swapvictim(ptptr p, int notself){#ifdef CONFIG_MULTI    ptptr c;    ptptr r = NULL;    ptptr f = NULL;    uint16_t sc = 0;    uint16_t s;    extern ptptr getproc_nextp;	/* Eww.. */    c = getproc_nextp;    do {        if (c->p_page) {	/* No point swapping someone in swap! */            /* Find the last entry before us */            if (c->p_status == P_READY)                r = c;            if (c->p_status > P_READY                    && p->p_status <= P_FORKING) {                /* relative position in order of waits, bigger is longer, can wrap but                   shouldn't really matter to us much if it does */                s = (waitno - c->p_waitno);                if (s >= sc) {                    sc = s;                    f = c;                }            }        }        c++;        if (c == ptab_end)            c = ptab;    }    while (c != getproc_nextp);    /* Oldest waiter gets the boot */    if (f) {#ifdef DEBUG        kprintf("swapvictim %x (page %d, state %d/n)", f,                f->p_page, f->p_status);#endif        return f;    }    /* No waiters.. the scheduler cycles so we will be the last to run       again, failing that the one before us that was ready */    if (notself == 0)        return udata.u_ptab;    return r;#else    used(p);    if (notself)        panic(PANIC_NOTSELF);    return udata.u_ptab;#endif}
开发者ID:aralbrec,项目名称:FUZIX,代码行数:59,


示例22: tty_write

int tty_write(uint8_t minor, uint8_t rawflag, uint8_t flag){	struct tty *t;	usize_t written = 0;	uint8_t c;	used(rawflag);	used(flag);	t = &ttydata[minor];	while (udata.u_count-- != 0) {		for (;;) {	/* Wait on the ^S/^Q flag */		        if (t->flag & TTYF_DEAD) {		                udata.u_error = ENXIO;		                return -1;                        }			if (!(t->flag & TTYF_STOP))				break;			if (psleep_flags_io(&t->flag, flag, &written))				return written;                        jobcontrol_out(minor, t);		}		if (!(t->flag & TTYF_DISCARD)) {			if (udata.u_sysio)				c = *udata.u_base;			else				c = ugetc(udata.u_base);			if (t->termios.c_oflag & OPOST) {				if (c == '/n' && (t->termios.c_oflag & ONLCR))					tty_putc_wait(minor, '/r');				else if (c == '/r' && (t->termios.c_oflag & OCRNL))					c = '/n';			}			tty_putc_wait(minor, c);		}		++udata.u_base;		++written;	}	return written;}
开发者ID:aralbrec,项目名称:FUZIX,代码行数:42,


示例23: addHatch

	void addHatch(const DL_HatchData& hatch)	{		if (used()) {			m_output->writeHatch1(m_writer, hatch, getAttributes());			m_currentHatch = hatch;			m_hatchLoopsRemaining = hatch.numLoops;			if (m_hatchLoopsRemaining == 0) {				m_output->writeHatch2(m_writer, m_currentHatch, getAttributes());			}		}	}
开发者ID:ohm2013,项目名称:gis,代码行数:11,


示例24: used

void DirectedGraph<T, MASK>::top_sort_rec(std::vector<size_t>* vertex_order) const {	std::vector<bool> used(this->vertices_count_, false);	std::vector<size_t> order;	for (const size_t v : this->vertices()) {		if (!used[v]) {			top_sort_rec_impl(v, order, used);		}	}	std::reverse(order.begin(), order.end());	vertex_order->swap(order);}
开发者ID:agul,项目名称:algolib,代码行数:11,


示例25: log_trace

bool DefNewGeneration::collection_attempt_is_safe() {  if (!to()->is_empty()) {    log_trace(gc)(":: to is not empty ::");    return false;  }  if (_old_gen == NULL) {    GenCollectedHeap* gch = GenCollectedHeap::heap();    _old_gen = gch->old_gen();  }  return _old_gen->promotion_attempt_is_safe(used());}
开发者ID:sourcemirror,项目名称:jdk-9-hotspot,代码行数:11,


示例26: permute

 vector<vector<int> > permute(vector<int> &num) {     // Start typing your C/C++ solution below     // DO NOT write int main() function     ret.clear();     if(num.size()==0) return ret;     vector<bool> used(num.size(),false);     vector<int> path;     path.clear();     dfs(num,used,0,num.size(),path);     return ret; }
开发者ID:icode123,项目名称:leetcode,代码行数:11,


示例27: permute

 vector<vector<int> > permute(vector<int> &num) {     // Start typing your C/C++ solution below     // DO NOT write int main() function     ret.clear();     int len = num.size();     if(!len)         return ret;     vector<bool> used(len, false);     vector<int> path;     dfs(num, 0, len, used, path);     return ret; }
开发者ID:pkuxxy,项目名称:LeetCode,代码行数:12,


示例28: areIsomorphic

	bool areIsomorphic(const unique_ptr<DFSM>& fsm1, const unique_ptr<DFSM>& fsm2) {		if (!fsm1->isReduced()) {			fsm1->minimize();		}		if (!fsm2->isReduced()) {			fsm2->minimize();		}		if ((fsm1->getNumberOfStates() != fsm2->getNumberOfStates()) ||			(fsm1->getNumberOfInputs() != fsm2->getNumberOfInputs()) ||			(fsm1->getNumberOfOutputs() != fsm2->getNumberOfOutputs()) ||			(fsm1->getType() != fsm2->getType()) ||			(fsm1->isOutputState() != fsm2->isOutputState()) ||			(fsm1->isOutputTransition() != fsm2->isOutputTransition())) {			return false;		}		vector<state_t> stateEq(fsm1->getNumberOfStates());		vector<bool> used(fsm1->getNumberOfStates(), false);		queue<state_t> fifo;		stateEq[0] = 0;		used[0] = true;		fifo.emplace(0);		while (!fifo.empty()) {			auto state = fifo.front();			fifo.pop();			if (fsm1->isOutputState() && 				(fsm1->getOutput(state, STOUT_INPUT) != fsm2->getOutput(stateEq[state], STOUT_INPUT))) {				return false;			}			for (input_t input = 0; input < fsm1->getNumberOfInputs(); input++) {				if (fsm1->isOutputTransition() && 					(fsm1->getOutput(state, input) != fsm2->getOutput(stateEq[state], input))) {					return false;				}				auto nextState1 = fsm1->getNextState(state, input);				auto nextState2 = fsm2->getNextState(stateEq[state], input);				if ((nextState1 == WRONG_STATE) || (nextState2 == WRONG_STATE)) {					return false;				} else if ((nextState1 == NULL_STATE) || (nextState2 == NULL_STATE)) {					if (nextState1 != nextState2) return false;				} else if (used[nextState1]) {					if (stateEq[nextState1] != nextState2) {						return false;					}				} else {					stateEq[nextState1] = nextState2;					used[nextState1] = true;					fifo.emplace(nextState1);				}			}		}		return true;	}
开发者ID:Soucha,项目名称:FSMlib,代码行数:53,


示例29: used

/** * Retrieve data and build internal representation. * * Given a series of haplogenotypes, for a given individual, calculate * the prob of each haplotype involved. * * The class variable matrix will be correctly filled with only those haplotypes that * have greater than 0.05 global frequency.  It will have been rescaled. *  * RTG updated Oct 14, 2010 to change the thresholding from 0.05% global expression * to showing up in at least n chromosomes (2m chr for m people).  Default is 20. * * @param input vector of EMPersonalProbsResults note that the person index is 0 based. * @param numHaps total number of haplotypes. * @param reweight If true, reweight the kept haplotypes. */void Zaykin::setup(const vector<EMPersonalProbsResults> &input, int numHaps, bool reweight){	if(phenotype.size() == 0){		RunOrderException e;		e.message = "Zaykin: called setup without setting a phenotype.";		throw e;	}	vector<vector<double> > matrixT; // temp used internally.	vector<int> used(numHaps, 0);		matrixT = vecops::getDblVec(phenotype.size() , numHaps);	for(unsigned int i=0; i < input.size(); ++i){		double t2 = input.at(i).prob;		if(isnan(t2)) t2 = 0;		// compute the actual haplotype number		// place half the percentage in that element in this individual.		int ti = input.at(i).leftHap;		matrixT.at(input.at(i).personId).at(ti) += t2 / 2;		used.at(ti)++;		ti = input.at(i).rightHap;		matrixT.at(input.at(i).personId).at(ti) += t2 / 2;		used.at(ti)++;	}	vector<unsigned int> keepIndices;	usedHaplotype.clear();	usedHaplotype.reserve(used.size());	for(unsigned int i=0; i < used.size(); i++){				if(used.at(i) > keepThresh){						usedHaplotype.push_back(true);			keepIndices.push_back(i);		}else{						usedHaplotype.push_back(false);		}	}	matrix = vecops::getDblVec(phenotype.size() , keepIndices.size());	for(unsigned int i=0;i < phenotype.size(); i++){				for(unsigned int j=0;j < keepIndices.size(); j++){			matrix.at(i).at(j) = matrixT.at(i).at(keepIndices.at(j));		}		if(reweight){			double cumSum = vecops::vecCumSum(matrix.at(i));			vecops::vecDiv(matrix.at(i) , cumSum);		}	}}
开发者ID:drmcwilli,项目名称:WFUBMC,代码行数:69,



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


C++ user函数代码示例
C++ usecs_to_jiffies函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。