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


C++ deque::end方法代码示例

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


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

示例1: DealWithWarp

void DealWithWarp (int x, int y) {
  static bool warp_pointer = XMLSupport::parse_bool(vs_config->getVariable ("joystick","warp_mouse","false"));
  static int mouse_warp_zone = XMLSupport::parse_int(vs_config->getVariable ("joystick","warp_mouse_zone","100"));
 if (warp_pointer) {
   if (joystick[MOUSE_JOYSTICK]->player<_Universe->numPlayers()) {
    if (x<mouse_warp_zone||y<mouse_warp_zone||x>g_game.x_resolution-mouse_warp_zone||y>g_game.y_resolution-mouse_warp_zone) {
      //VSFileSystem::Fprintf (stderr,"warped from %d %d to %d %d",mousex,mousey, g_game.x_resolution/2,g_game.y_resolution/2);
      
      int delx = -x+g_game.x_resolution/2;
      int dely = -y+g_game.y_resolution/2;
      mousex+=delx;
      mousey+=dely;
      deque<MouseEvent>::iterator i;
      for (i=eventQueue.begin();i!=eventQueue.end();i++) {
	i->x+=delx;
	i->y+=dely;
      }
      if (warpallowage-->=0) {
	winsys_warp_pointer(g_game.x_resolution/2,g_game.y_resolution/2);
      }
    }
   }
  }

}
开发者ID:bsmr-games,项目名称:Privateer-Gemini-Gold,代码行数:25,代码来源:in_mouse.cpp

示例2: func

void func(deque<char>& stack, int left, int right, vector<string>& result)
{
	if(left == 0 && right == 0)
	{
		result.push_back(string(stack.begin(),stack.end()));
		return;
	}

	if(left > right)
		return;
	
	if(left > 0)
	{
		stack.push_back('(');
		func(stack,left-1,right,result);
		stack.pop_back();
	}

	if(right > 0)
	{
		stack.push_back(')');
		func(stack,left,right-1,result);
		stack.pop_back();
	}
}
开发者ID:wxlARG,项目名称:leetcode,代码行数:25,代码来源:120212.cpp

示例3: PushFilteredResults

void LogSorter::PushFilteredResults(deque<LogEntry>& filteredResultQueue)
{
	//TODO: this may have very poor performance, need to address later
	std::unique_lock<std::mutex> lock(m_mtx);
	m_resultQueue.insert(m_resultQueue.end(), filteredResultQueue.begin(), filteredResultQueue.end());;
	std::stable_sort(m_resultQueue.begin(), m_resultQueue.end(), compare_logentry);
}
开发者ID:wykluck,项目名称:LiveActive,代码行数:7,代码来源:LogSorter.cpp

示例4: renderParticles

    void renderParticles()
    {
        glDisable(GL_LIGHTING);
        glBindTexture(GL_TEXTURE_2D, texId);

        liveParticles = 0;

        deque<cParticle>::iterator ptlIter;
        for( ptlIter = particles.begin(); ptlIter != particles.end(); ptlIter++ )
        {
            if(ptlIter->active)
            {
                glBegin(GL_TRIANGLE_STRIP);
                    glColor4f(ptlIter->r, ptlIter->g, ptlIter->b, ptlIter->life);
                    glTexCoord2d(1,1); glVertex3f(ptlIter->position.x + 0.1f, ptlIter->position.y + 0.1f, ptlIter->position.z); // Top Right
                    glTexCoord2d(0,1); glVertex3f(ptlIter->position.x - 0.1f, ptlIter->position.y + 0.1f, ptlIter->position.z); // Top Left
                    glTexCoord2d(1,0); glVertex3f(ptlIter->position.x + 0.1f, ptlIter->position.y - 0.1f, ptlIter->position.z); // Bottom Right
                    glTexCoord2d(0,0); glVertex3f(ptlIter->position.x - 0.1f, ptlIter->position.y - 0.1f, ptlIter->position.z); // Bottom Left
                glEnd();
                liveParticles ++;
            }
        }

        glEnable(GL_LIGHTING);
    }
开发者ID:runemoennike,项目名称:asteroids,代码行数:25,代码来源:particle.cpp

示例5: getReferenceClass

string getReferenceClass(deque<dtdclass *> & d_Class, string root){//function to find the reference class
    deque<dtdclass*>::iterator first;/*record the first position of the deque*/
    deque<dtdclass*>::iterator last;/*record the last position of the deque*/
    first = d_Class.begin();//get the begin of the deque
    last = d_Class.end();//get the end of the deque
    if(getISA(d_Class, root, root)==true){/*check the root class have any gener class*/
        root = "("+root+")+";
    }else{root = root+"+";}
    for (deque<dtdclass *>::iterator i=first; i !=last;i++){
        if(((*i)->getRef())==true && (*i)->getInHeader()==false){
            string temp;
            string ISAname;
            temp = (*i)->getname();
            ISAname = (*i)->getname();
            if(getISA(d_Class, temp, ISAname)==true){
                root = root + ", (" + ISAname + ")"; /*add the class name in to the string*/
            }
            else{
                root  = root + ", " + (*i)->getname();/*add the class name in to the string*/
            }
            if((*i)->getlevel()==1){root = root + "+";}
            else{root = root + "*";}
        }
    }
    return root;
}
开发者ID:vitawebsitedesign,项目名称:321,代码行数:26,代码来源:main.cpp

示例6: isDivByEleven

bool isDivByEleven(const deque<unsigned int>& number){
  if (number.size() == 1){
    if (number[0] == 0)
      return true;
    else
      return false;
  }

  bool isOdd = true;

  deque<unsigned int> odd;
  deque<unsigned int> even;

  for (deque<unsigned int>::const_iterator itr = number.begin(), endItr = number.end() ; itr != endItr; itr++, isOdd = !isOdd)
      {
	unsigned int digit = *itr;

	if (isOdd)
	  vecSum(odd, digit);
	else 
	  vecSum(even, digit);
      }
  deque<unsigned int> diff;
  if (isBigger(odd, even))
    vecDiff(odd, even, diff);
  else 
    vecDiff(even, odd, diff);

  if (isDivByEleven(diff))
    return true;
  
  return false;
}
开发者ID:bhrzslm,项目名称:practice,代码行数:33,代码来源:test2.cpp

示例7: shuffle_cards

void shuffle_cards() {
	// Check for clearing
	cards_.clear();
	// Instantiate Deck
	for(int thirteen = 1; thirteen < 14; thirteen++) {
		for(int four = 0; four < 4; four++) {
			card birthCard(thirteen, four);
			switch(birthCard.value) {
				case 11:
					birthCard.value = J;
					break;
				case 12:
					birthCard.value = Q;
					break;
				case 13:
					birthCard.value = K;
					break;
				case 1:
					birthCard.value = A;
					break;
				default:
					// The card was 2-9
					break;
			}

			cards_.push_back(birthCard);
		}
	}
	random_shuffle(cards_.begin(), cards_.end());
	// (cards_.begin(), cards_.end(), mt);
}
开发者ID:Graystripe17,项目名称:BlackJack-Evolution-AI,代码行数:31,代码来源:Artificial+Intelligence+BlackJack.cpp

示例8: tickParticles

    void tickParticles()
    {
        deque<cParticle>::iterator ptlIter;
        for( ptlIter = particles.begin(); ptlIter != particles.end(); ptlIter ++ )
        {
            if(ptlIter->life > 0)
            {
                ptlIter->position.x += ptlIter->velocity.x / 100;
                ptlIter->position.y += ptlIter->velocity.y / 100;
                ptlIter->position.z += ptlIter->velocity.z / 100;

                ptlIter->velocity.x += ptlIter->acceleration.x / 100;
                ptlIter->velocity.y += ptlIter->acceleration.y / 100;
                ptlIter->velocity.z += ptlIter->acceleration.z / 100;

                ptlIter->life -= ptlIter->fade / 100;

                if(ptlIter->position.x < limits.x1) ptlIter->position.x = limits.x2;
                if(ptlIter->position.y < limits.y1) ptlIter->position.y = limits.y2;
                if(ptlIter->position.x > limits.x2) ptlIter->position.x = limits.x1;
                if(ptlIter->position.y > limits.y2) ptlIter->position.y = limits.y1;
            }
            else
            {
                ptlIter->active = false;
            }
        }
    }
开发者ID:runemoennike,项目名称:asteroids,代码行数:28,代码来源:particle.cpp

示例9: makeStarPath

IWORKPathPtr_t makeStarPath(const IWORKSize &size, const unsigned points, const double innerRadius)
{
  // user space canvas: [-1:1] x [-1:1]

  // create outer points
  const deque<Point> outerPoints = rotatePoint(Point(0, -1), points);

  // create inner points
  const double angle = etonyek_two_pi / points;
  deque<Point> innerPoints(outerPoints);
  transform(innerPoints, scale(innerRadius, innerRadius) * rotate(angle / 2));

  // merge them together
  deque<Point> pathPoints;
  assert(outerPoints.size() == innerPoints.size());
  for (deque<Point>::const_iterator itO = outerPoints.begin(), itI = innerPoints.begin();
       (itO != outerPoints.end()) && (itI != innerPoints.end());
       ++itO, ++itI)
  {
    pathPoints.push_back(*itO);
    pathPoints.push_back(*itI);
  }

  // create the path
  transform(pathPoints, scale(size.m_width, size.m_height) * scale(0.5, 0.5) * translate(1, 1));
  const IWORKPathPtr_t path = makePolyLine(pathPoints);

  return path;
}
开发者ID:anuragkanungo,项目名称:libetonyek,代码行数:29,代码来源:IWORKShape.cpp

示例10: setGeneralisation

void setGeneralisation(deque<dtdclass *>& d_class, string className, string ISAname){
    string tempGeneral,fatherClass;
    deque<dtdclass*>::iterator first;/*record the first position of the deque*/
    deque<dtdclass*>::iterator last;/*record the last position of the deque*/
    if(!d_class.empty()){
        first = d_class.begin();//get the begin of the deque
        last = d_class.end();//get the end of the deque
        for (deque<dtdclass *>::iterator i=first; i!= last;i++){
            tempGeneral = (*i)->getname();
            if(tempGeneral == className){
                (*i)->setbelong_to(ISAname);//set the belong_to class name
                for(deque<dtdclass *>::iterator j=first; j!= last;j++){
                    fatherClass = (*j)->getname();
                    int amountAtt = (*j)->getAttributeAmount();
                    if(fatherClass == ISAname){//find the class, and get the attribute
                        (*j)->setlevel(1);
                        for(int tempAmount = 0; tempAmount <amountAtt; tempAmount ++){
                            attribute *newAttribute = (*j)->getattribute();
                            attribute tempAttribute;
                            strcpy(tempAttribute.att_name, newAttribute->att_name);
                            tempAttribute.isId= newAttribute->isId;
                            tempAttribute.ismulti= newAttribute->ismulti;
                            (*i)->setattribute(tempAttribute);//copy attribute from the "father" to the "son" class
                        }
                    }
                }
            }
        }
    }
}
开发者ID:vitawebsitedesign,项目名称:321,代码行数:30,代码来源:main.cpp

示例11: print

 string print()
 {
     stringstream ss;
     deque<d_t>::iterator it;
     for(it = number.begin(); it != number.end(); it++) ss << (*it);
     return(ss.str());
 }
开发者ID:etoestja,项目名称:inf,代码行数:7,代码来源:main.cpp

示例12: setReferenceClass

void setReferenceClass(deque<dtdclass *> & d_Class, string className){
    deque<dtdclass*>::iterator first;/*record the first position of the deque*/
    deque<dtdclass*>::iterator last;/*record the last position of the deque*/
    first = d_Class.begin();
    last = d_Class.end();
    int numberAssoication;
    for (deque<dtdclass *>::iterator i=first; i !=last;i++){
        if((*i)->getname()== className){
            if((*i)->getRef() ==true){/*find the match class and the class Ref is true than set it false*/
                (*i)->setRef(false);
                numberAssoication = (*i)->getAssociaAmount();
                for(int current=0; current<numberAssoication; current++){/*set all classes relate to this class being the not reference class*/
                        associate * tempAsso = (*i)->getassociation(current);
                        if(tempAsso->base_Max < 3 || tempAsso->to_Max < 3 ){
                        string tempAssoname =  tempAsso->tclass_name;
                        setReferenceClass(d_Class, tempAssoname);/*to find are there any class have relationship with this class*/
                        }
                }
                for(deque<dtdclass *>::iterator j = first; j!= last; j++) {
                    string belong_to; 
                    belong_to = (*j)->getbelong_to();
                    if(belong_to == (*i)->getname()){/*if the class is belong to the (*i) class, set this class is reference class*/
                        (*j)->setRef(false);
                        setReferenceClass(d_Class, (*j)->getname());/*to find are there any class is belong to this class*/
                    }
                }
            }
            
        }
    }
}
开发者ID:vitawebsitedesign,项目名称:321,代码行数:31,代码来源:main.cpp

示例13: load_data

void analyser::load_data(const deque<char> & buff)
{
    m_pack.clear();

    m_pack.insert( m_pack.begin(), buff.begin(),
                                    buff.end() );
}
开发者ID:tinnfu,项目名称:ftp,代码行数:7,代码来源:analyser.cpp

示例14: print_cumulative

int print_cumulative (deque<double> & kws, string file, int number_of_step) {
		
	
	
	char buffer [file.size()+1];
	cast_string_to_char(file, buffer);
	
	ofstream expout (buffer);
	sort(kws.begin(), kws.end());
	
	int step=(kws.size()-1)/number_of_step;
	step=max(step, 1);
			
	for (int i=0; i<int(kws.size()); i++) if(i%step==0)
		expout<<kws[i]<<" "<<double(i+1)/(kws.size())<<endl;
			
			
	
			
		

	return 0;


}
开发者ID:RoyZhengGao,项目名称:CommunityEvaluation,代码行数:25,代码来源:histograms.cpp

示例15: draw

void ofxBlobTracker::draw(float x,float y,float w, float h) {
	// stroked rect
	ofEnableAlphaBlending();
	ofSetColor(0, 0, 0, 70);
	ofRect(x, y, w, h);
	ofSetHexColor(0xFFFFFF);
	
	ofNoFill();
	ofRect(x, y, w, h);
	
	glPushMatrix();
	glTranslatef(x, y, 0);
	ofSetColor(0,150, 0);
	
	map<int,ofVec3f>::iterator it;
	for(it = smoothedBlobs.begin(); it!=smoothedBlobs.end(); it++) {
		ofCircle((*it).second.x*w, (*it).second.y*h, 5);
		ofDrawBitmapString("id: "+ofToString((*it).first), (*it).second.x*w, (*it).second.y*h);
		blobStore.push_back((*it).second);
	}

	while(blobStore.size()>50) {
		blobStore.pop_front();
	}
	deque<ofVec2f>::iterator itr;
	for(itr = blobStore.begin(); itr!=blobStore.end(); itr++) {
		ofCircle((*itr).x*w,(*itr).y*h, 5);
	}
	glPopMatrix();
	ofFill();
	
}
开发者ID:HellicarAndLewis,项目名称:ProjectDonk,代码行数:32,代码来源:ofxBlobTracker.cpp


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