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


C++ list::push_front方法代码示例

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


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

示例1: tracePath

void AAStar::tracePath(ANode* x, std::list<ANode*>& path) {
	while (x != start) {
		path.push_front(x);
		x = x->parent;
	}
	path.push_front(start);
}
开发者ID:Error323,项目名称:E323AI,代码行数:7,代码来源:AAStar.cpp

示例2: encontra_menor_caminho

//Encontra o menor caminho até o objetivo
void mazeProcessing::encontra_menor_caminho(int* pos_obj, int** mapa_distancias, int** paredes, std::list<int> &caminho_x, std::list<int> &caminho_y)
{
	caminho_y.push_front(pos_obj[0]);
	caminho_x.push_front(pos_obj[1]);

    int pos_atual[2], pos_prox[2];
	pos_atual[0] = pos_obj[0];
	pos_atual[1] = pos_obj[1];
    while(mapa_distancias[pos_atual[0]][pos_atual[1]] != 0)
    {
    	int j = -1;
    	for(int i = 0; i < 4; i++)
		{
			pos_prox[0] = pos_atual[0] + (i / 2) * j;
			pos_prox[1] = pos_atual[1] + ((3 - i) / 2) * j;
			if(verifica_conexao(pos_atual, pos_prox, paredes))
		    	if(mapa_distancias[pos_prox[0]][pos_prox[1]] == mapa_distancias[pos_atual[0]][pos_atual[1]] - 1)
		    	{
		    		caminho_y.push_front(pos_prox[0]);
		    		caminho_x.push_front(pos_prox[1]);
		    		pos_atual[0] = pos_prox[0];
		    		pos_atual[1] = pos_prox[1];
		    		break;
		    	}
		    j *= -1;
		}
    }
}
开发者ID:rafbel,项目名称:MazeSolver,代码行数:29,代码来源:mazeProcessingClass.cpp

示例3: clear

void TranslationTableItem::clear(std::list<TranslationPage*> &pages) {
  //if (mips32) {
    //pages.push_front(static_cast<TranslationPage*>(mips32));
    //mips32 = NULL;
  //}
  //if (mips64) {
    //pages.push_front(static_cast<TranslationPage*>(mips64));
    //mips64 = NULL;
  //}
  if (arm32) {
    pages.push_front(static_cast<TranslationPage*>(arm32));
    arm32 = NULL;
  }
  if (thumb) {
    pages.push_front(static_cast<TranslationPage*>(thumb));
    thumb = NULL;
  }
  if (arm_v6) {
    pages.push_front(static_cast<TranslationPage*>(arm_v6));
    arm_v6 = NULL;
  }
  if (thumb_v6) {
    pages.push_front(static_cast<TranslationPage*>(thumb_v6));
    thumb_v6 = NULL;
  }
  //if (ppc) {
    //pages.push_front(static_cast<TranslationPage*>(ppc));
    //ppc = NULL;
  //}
}
开发者ID:kinhoa122345,项目名称:virtualsoc-wcdma,代码行数:30,代码来源:translation_table.cpp

示例4: listCollisions

/**
 * Returns by reference the list of new and ceased collisions
 *  that will be the objects of ONENTER and ONEXIT events.
 */
void BulletWorld::listCollisions(std::list <ContactPoint> &contactPoints) {

/*
 * Creates a list of all the current collisions on the World
 * */
    std::map<std::pair<long,long>, ContactPoint> currCollisions;
    int numManifolds = mPhysicsWorld->getDispatcher()->getNumManifolds();
    btPersistentManifold *contactManifold;

    for (int i = 0; i < numManifolds; i++) {
        ContactPoint contactPt;

        contactManifold = mPhysicsWorld->getDispatcher()->
                getManifoldByIndexInternal(i);

        contactPt.body0 = (BulletRigidBody *) (contactManifold->getBody0()->getUserPointer());
        contactPt.body1 = (BulletRigidBody *) (contactManifold->getBody1()->getUserPointer());
        contactPt.normal[0] = contactManifold->getContactPoint(0).m_normalWorldOnB.getX();
        contactPt.normal[1] = contactManifold->getContactPoint(0).m_normalWorldOnB.getY();
        contactPt.normal[2] = contactManifold->getContactPoint(0).m_normalWorldOnB.getZ();
        contactPt.distance = contactManifold->getContactPoint(0).getDistance();
        contactPt.isHit = true;

        std::pair<long, long> collisionPair((long)contactPt.body0, (long)contactPt.body1);
        std::pair<std::pair<long, long>, ContactPoint> newPair(collisionPair, contactPt);
        currCollisions.insert(newPair);

        /*
         * If one of these current collisions is not on the list with all the previous
         * collision, then it should be on the return list, because it is an onEnter event
         * */
        auto it = prevCollisions.find(collisionPair);
        if ( it == prevCollisions.end()) {
            contactPoints.push_front(contactPt);
        } 
        contactManifold = 0;
    }

    /*
     * After going through all the current list, go through all the previous collisions list,
     * if one of its collisions is not on the current collision list, then it should be
     * on the return list, because it is an onExit event
     * */
    for (auto it = prevCollisions.begin(); it != prevCollisions.end(); ++it) {
        if (currCollisions.find(it->first) == currCollisions.end()) {
            ContactPoint cp = it->second;
            cp.isHit = false;
            contactPoints.push_front(cp);
        }
    }

/*
 * Save all the current collisions on the previous collisions list for the next iteration
 * */
    prevCollisions.clear();
    prevCollisions.swap(currCollisions);

}
开发者ID:Vittalbabu,项目名称:GearVRf,代码行数:62,代码来源:bullet_world.cpp

示例5: altCodes

void FlipMemo::altCodes(const ResBlk& rblk,	bool useXplorNames, bool useOldNames, bool bbModel, 
						std::list<char>& sch) {
	char ch, buf[10];
	int rt = 0, k = 0, cursor = 0;
	bool isInResidueSet = FALSE, dupalt = FALSE;

	const char *resname = rblk.firstRec().resname();

	for(rt = 0; _resFlip[rt].rname; rt++) {
	        if ( (strcmp(_resFlip[rt].rname, resname) == 0)
	      		&& !(((_resFlip[rt].flags & USEOLDNAMES) && ! useOldNames)
	        	|| ((_resFlip[rt].flags & XPLORNAME)  && ! useXplorNames)
	        	|| ((_resFlip[rt].flags & USENEWNAMES) && (useOldNames || useXplorNames))) ) {
			isInResidueSet = TRUE;
			break; // residue type is one of those we are concerned with
		}
	}
	if (isInResidueSet) {
		std::multimap<std::string, PDBrec*> pdb = rblk.atomIt();
		std::string key;
		std::multimap<std::string, PDBrec*>::const_iterator pdbit = pdb.begin();
		PDBrec* atsq = NULL;
		while(pdbit != pdb.end()) {
			key = pdbit->first;
			for (; pdbit != pdb.end() && pdbit->first == key; ++pdbit) {
				atsq = pdbit->second;
				bool foundname = FALSE;
				for(int i=_resFlip[rt].fromScat;
				i < _resFlip[rt].fromScat+_resFlip[rt].numScat; i++) {

					if (strcmp(_pointName[rt][i], atsq->atomname()) == 0) {
						foundname = TRUE;
						break;
					}
				}
				if (foundname) {
					ch = toupper(atsq->alt());
					if (ch != ' ') {
						dupalt = FALSE;
						for(k = 0; k < cursor; k++) {
							if (ch == buf[k]) { dupalt = TRUE; break; }
						}
						if (! dupalt) {
							buf[cursor++] = ch;
						}
					}
				}
			}
		}
		if (cursor < 1) { sch.push_front(' '); } // no alt codes
		else {
			for(k = 0; k < cursor; k++) { // at least one alt code
				sch.push_front(buf[k]);
			}
		}
	}
}
开发者ID:zhangxiaoyu11,项目名称:mAMBER,代码行数:57,代码来源:FlipMemo.cpp

示例6: if

void PtrAnal::
ProcessMod(AstInterface& fa, const std::string& readname, 
          std::list<std::string>& fields, const AstNodePtr& mod)
{
  std::string modname;
  AstNodePtr p = mod;
  if (fa.IsVarRef(mod) || fa.IsArrayAccess(mod, &p)) {
      modname = Get_VarName(fa,p);
      Stmt stmt_last = fields.size()?
                      field_x_eq_y(modname, fields, readname)
                     : x_eq_y(modname, readname);
      stmts_pushback(stmts,stmt_last);
      namemap[mod.get_ptr()] = VarRef(stmt_last,modname);
  }
  else {
     AstInterface::OperatorEnum op;
     AstNodePtr p2;
     if (fa.IsUnaryOp(mod,&op, &p) && op == AstInterface::UOP_DEREF) {
            std::string lhs = Get_VarName(fa,p); 
            Stmt stmt_last  = deref_x_eq_y(lhs, fields, readname); 
            stmts_pushback(stmts,stmt_last);
            namemap[p.get_ptr()] = VarRef(stmt_last,lhs);
            namemap[mod.get_ptr()] = VarRef(stmt_last, readname);
     }
    else if (fa.IsBinaryOp(mod,&op,&p,&p2)) { 
         if (op==AstInterface::BOP_DOT_ACCESS) {
            std::string field = Local_GetFieldName(fa, p2);
            fields.push_front(field);
            ProcessMod(fa, readname, fields, p);
            Stmt stmt_last = stmts_back(stmts);
            namemap[mod.get_ptr()] = VarRef(stmt_last, readname);
         }
         else if (op==AstInterface::BOP_ARROW_ACCESS) {
            std::string lhs = Get_VarName(fa, p), field = Local_GetFieldName(fa, p2);
            fields.push_front(field);
            Stmt stmt_last  = deref_x_eq_y(lhs,fields,readname);
            stmts_pushback(stmts,stmt_last);
            namemap[p.get_ptr()] = VarRef(stmt_last,lhs);
            namemap[mod.get_ptr()] = VarRef(stmt_last, readname);
         }
         else {
            std::cerr << "can't handle " << AstToString(mod) << "\n";
            assert(false); // other operations? to be handled later  
         }
     }
     else if (fa.IsFunctionCall(mod)) {
         std::string lhs = Get_VarName(fa, mod);
         Stmt stmt_last = deref_x_eq_y(lhs, fields, readname);
         stmts_pushback(stmts,stmt_last);
         namemap[mod.get_ptr()] = VarRef(stmt_last,lhs);
     }
     else {
       std::cerr << "cannot process " << AstToString(mod) << "\n";
       assert(false); // other operations? to be handled later  
    }
  }
}
开发者ID:Federico2014,项目名称:edg4x-rose,代码行数:57,代码来源:PtrAnal.C

示例7:

/**
 * \brief Get the items concerned by a progress/move of this one.
 * \param d (out) A list to which are added such items.
 */
void bear::bridge::get_dependent_items( std::list<physical_item*>& d ) const
{
  items_list_const_iterator it;
  
  for( it=m_items.begin(); it!=m_items.end(); ++it )
    if ( it->get_item().get() != NULL ) 
      d.push_front( it->get_item().get() );

  d.push_front(m_top_left_ref);
  d.push_front(m_top_right_ref);
} // bridge::get_dependent_items()
开发者ID:yannicklm,项目名称:bear,代码行数:15,代码来源:bridge.cpp

示例8: addSuccessor

void GridWorldProblem::addSuccessor(
    GridWorldState* state, std::list<mlcore::Successor>& successors,
    int val, int limit, int newx, int newy, double prob)
{
    bool isWall = (walls.count(std::pair<int, int> (newx, newy)) != 0);
    if (val > limit && !isWall) {
        GridWorldState *next = new GridWorldState(this, newx, newy);
        successors.push_front(mlcore::Successor(this->addState(next), prob));
    } else {
        successors.push_front(mlcore::Successor(state, prob));
    }
}
开发者ID:sandysa,项目名称:mdp-lib,代码行数:12,代码来源:GridWorldProblem.cpp

示例9: copyDefaultProperties

void ActiveProducer::copyDefaultProperties(	ActiveMessage& activeMessage,
											ActiveLink& activeLink,
											std::list<std::string>& defaultKeysList)
	throw (ActiveException){

	std::stringstream logMessage;

	std::string key;
	try{
		//looping through default properties and inserting into activeMessage
		for (int it=0; it<activeLink.getPropertySize();it++){
			Parameter* property=activeLink.getProperty(it,key);
			switch (property->getType()){
			case ACTIVE_INT_PARAMETER:{
				IntParameter* intProperty=(IntParameter*)property;
				try{
					activeMessage.insertIntProperty(key,intProperty->getValue());
					defaultKeysList.push_front(key);
				}catch (ActiveException& ae){
					throw ae;
				}
			}
			break;
			case ACTIVE_REAL_PARAMETER:{
				RealParameter* realProperty=(RealParameter*)property;
				try {
					activeMessage.insertRealProperty(key,realProperty->getValue());
					defaultKeysList.push_front(key);
				}catch (ActiveException& ae){
					throw ae;
				}
			}
			break;
			case ACTIVE_STRING_PARAMETER:{
				StringParameter* stringProperty=(StringParameter*)property;
				try{
					activeMessage.insertStringProperty(key,stringProperty->getValue());
					defaultKeysList.push_front(key);
				}catch (ActiveException& ae){
					throw ae;
				}
			}
			break;
			}
		}
	}catch (ActiveException& ae){
		logMessage << "ERROR. Cannot copy default properties to message" << ae.getMessage();
		throw ActiveException(logMessage.str());
	}
}
开发者ID:jinghuaswsx,项目名称:activeinterface,代码行数:50,代码来源:ActiveProducer.cpp

示例10: registerWith

inline void Observer::registerWith(
    const boost::shared_ptr<Observable>& h) {
    if (h) {
        observables_.push_front(h);
        h->registerObserver(this);
    }
}
开发者ID:derekcameron,项目名称:quantlibcl,代码行数:7,代码来源:observable.hpp

示例11: grow

		void grow(void){
			Cord c;
			c.x  = cords.front().x;
			c.y  = cords.front().y;
			switch (direction) {
				case LEFT:
					if (c.x == 0) {
						c.x = MAX_X;
						if (c.y == 0) c.y = MAX_Y;
						c.y-=1;
					}
					c.x-=1;
					break;
				case RIGHT:
					if (c.x == MAX_X) {
						c.x = 0;
						if (c.y == MAX_Y) c.y = 0;
						c.y+=1;
					}
					c.x+=1;
					break;
				case UP:
					if (c.y == 0) c.y = MAX_Y;
					c.y-=1;
					break;
				case DOWN:
					if (c.y == MAX_Y) c.y = 0;
					c.y+=1;
					break;
			}
			cords.push_front(c);
		}
开发者ID:jamesshawver1,项目名称:razer_blackwidow_chroma_driver,代码行数:32,代码来源:snake.cpp

示例12: visit

bool Graph::visit(int v, std::list<int> & sortedList)
{
    VertexIterator iter = vertices.find(v);
    if (iter != vertices.end())
    {
        if (iter->second.visited == false)
        {
            iter->second.visited = true;

            std::list<Edge>::const_iterator liter = iter->second.adjList.begin();
            for (; liter != iter->second.adjList.end(); ++liter)
            {
                if (!visit(liter->dest, sortedList))
                {
                    return false;
                }
            }
            sortedList.push_front(iter->first);
        }
        else
        {
            return false;
        }
    }
    return true;
}
开发者ID:Ludwigromanam,项目名称:medicine-cpp,代码行数:26,代码来源:graph.cpp

示例13: de_robv_android_xposed_XposedBridge_hookMethodNative

static void de_robv_android_xposed_XposedBridge_hookMethodNative(JNIEnv* env, jclass clazz, jobject declaredClassIndirect, jint slot) {
    // Usage errors?
    if (declaredClassIndirect == NULL) {
        dvmThrowIllegalArgumentException("declaredClass must not be null");
        return;
    }
    
    // Find the internal representation of the method
    ClassObject* declaredClass = (ClassObject*) dvmDecodeIndirectRef(dvmThreadSelf(), declaredClassIndirect);
    Method* method = dvmSlotToMethod(declaredClass, slot);
    if (method == NULL) {
        dvmThrowNoSuchMethodError("could not get internal representation for method");
        return;
    }
    
    if (findXposedOriginalMethod(method) != xposedOriginalMethods.end()) {
        // already hooked
        return;
    }
    
    // Save a copy of the original method
    xposedOriginalMethods.push_front(*((MethodXposedExt*)method));

    // Replace method with our own code
    SET_METHOD_FLAG(method, ACC_NATIVE);
    method->nativeFunc = &xposedCallHandler;
    method->registersSize = method->insSize;
    method->outsSize = 0;

    if (PTR_gDvmJit != NULL) {
        // reset JIT cache
        MEMBER_VAL(PTR_gDvmJit, DvmJitGlobals, codeCacheFull) = true;
    }
}
开发者ID:ShiningDrops,项目名称:Xposed,代码行数:34,代码来源:xposed.cpp

示例14: main

int main ()
{
	scanf("%d %d",&ilosc_kolumn,&ilosc_wierszy);
	for(int licznikW = 0; licznikW <ilosc_wierszy; licznikW++) {
		scanf("%s",&tablicaWK[licznikW]);
		for(int licznikK = 0; licznikK < ilosc_kolumn; licznikK++) {
			if (tablicaWK[licznikW][licznikK] == POSZUKIWACZ) {
				poszukiwacz.nr_wiersza = licznikW;
				poszukiwacz.nr_kolumny = licznikK;
				poszukiwacz.ojciec = BRAK;
			} else if (tablicaWK[licznikW][licznikK] == SKARB) {
				skarb.nr_wiersza = licznikW;
				skarb.nr_kolumny = licznikK;
			}			
		}
	}

	/*KONIEC POBIERANIA DANYCH*/
	lista_wpolrzednych.push_front(poszukiwacz);
	
	minimalna_ilosc_krokow = 0;
	int kod_wyjscia = 0;
	do
	{
		minimalna_ilosc_krokow++; 
		kod_wyjscia = petla(minimalna_ilosc_krokow);
		if (kod_wyjscia == KONIEC_SZUKANIA) {
			printf("%s",SLOWO_NIE);
			return 0;
		}
	} while(kod_wyjscia == 0);
	printf("%d", kod_wyjscia);
	return 0;
}
开发者ID:krzysztofp,项目名称:Algo-n-Datas-in-C,代码行数:34,代码来源:daguerreA.cpp

示例15: MinCirclePoints

double MinCirclePoints(double &mincx, double &mincy,
                       std::list <std::list<wxRealPoint> > &all_points,
                       std::vector<wxRealPoint> &points)
{
    if(all_points.size() == 0)
        return MinCircle(mincx, mincy, points);

    std::list<wxRealPoint> cpoints = all_points.front();
    all_points.pop_front();

    int s =  points.size();
    points.push_back(wxRealPoint());
    double mind = INFINITY;
    for(std::list<wxRealPoint>::iterator it = cpoints.begin();
        it != cpoints.end(); it++) {
        points[s] = *it;

        double cx, cy, cd;
        cd = MinCirclePoints(cx, cy, all_points, points);
        if(cd < mind) {
            mind = cd;
            mincx = cx;
            mincy = cy;
        }
    }
    points.pop_back();
    all_points.push_front(cpoints);

    if(isinf(mind))
        return NAN;
    return mind;
}
开发者ID:dongmingdmdm,项目名称:celestial_navigation_pi,代码行数:32,代码来源:CelestialNavigationDialog.cpp


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