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


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

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


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

示例1: add_connected_gates

		void add_connected_gates(int gate, std::forward_list<int>& gates)
		{
			for(size_t i = 0; i < channels.size(); ++i) {

				if(channels[i][0] == gate)
					gates.push_front(channels[i][1]);

				if(channels[i][1] == gate)
					gates.push_front(channels[i][0]);
			}
		}
开发者ID:ny-c,项目名称:ce,代码行数:11,代码来源:humandesign.cpp

示例2: getList

void AreaCombat::getList(const Position& centerPos, const Position& targetPos, std::forward_list<Tile*>& list) const
{
	const MatrixArea* area = getArea(centerPos, targetPos);
	if (!area) {
		return;
	}

	uint32_t centerY, centerX;
	area->getCenter(centerY, centerX);

	Position tmpPos(targetPos.x - centerX, targetPos.y - centerY, targetPos.z);
	uint32_t cols = area->getCols();
	for (uint32_t y = 0, rows = area->getRows(); y < rows; ++y) {
		for (uint32_t x = 0; x < cols; ++x) {
			if (area->getValue(y, x) != 0) {
				if (g_game.isSightClear(targetPos, tmpPos, true)) {
					Tile* tile = g_game.map.getTile(tmpPos);
					if (!tile) {
						tile = new StaticTile(tmpPos.x, tmpPos.y, tmpPos.z);
						g_game.map.setTile(tmpPos, tile);
					}
					list.push_front(tile);
				}
			}
			tmpPos.x++;
		}
		tmpPos.x -= cols;
		tmpPos.y++;
	}
}
开发者ID:krugerdevelopers,项目名称:forgottenserver,代码行数:30,代码来源:combat.cpp

示例3: extract

    static void extract(const jsonpack::value &v, char* json_ptr, std::forward_list<T> &value)
    {
        array_t arr = *v._arr;

        value.clear();

        for(const auto &it : arr)
        {
#ifndef _MSC_VER
            // Initialize before use
            T val = {};
#else
            T val;
#endif  
            if( json_traits<T&>::match_token_type(it) )
            {
                json_traits<T&>::extract(it, json_ptr, val);
                // forward_list not support insert operation
                value.push_front(val);
            }
            else
            {
                throw type_error( "Forward_list item type mismatch" );
            }

        }
    }
开发者ID:kylemanna,项目名称:jsonpack,代码行数:27,代码来源:sequences.hpp

示例4: u

typename boost::disable_if<
    typename detail::is_default_constructible<
        typename std::forward_list<T, Allocator>::value_type
    >,
    void
>::type
collection_load_impl(
    Archive & ar,
    std::forward_list<T, Allocator> &t,
    collection_size_type count,
    item_version_type item_version
){
    t.clear();
    boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
    ar >> boost::serialization::make_nvp("item", u.reference());
    t.push_front(u.reference());
    typename std::forward_list<T, Allocator>::iterator last;
    last = t.begin();
    ar.reset_object_address(&(*t.begin()) , & u.reference());
    while(--count > 0){
        detail::stack_construct<Archive, T> u(ar, item_version);
        ar >> boost::serialization::make_nvp("item", u.reference());
        last = t.insert_after(last, u.reference());
        ar.reset_object_address(&(*last) , & u.reference());
    }
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:26,代码来源:forward_list.hpp

示例5:

 StackTrieNode *createTrieNode(uint32_t ThreadId, int32_t FuncId,
                               StackTrieNode *Parent) {
   NodeStore.push_front(StackTrieNode{FuncId, Parent, {}, {{}, {}}});
   auto I = NodeStore.begin();
   auto *Node = &*I;
   if (!Parent)
     Roots[ThreadId].push_back(Node);
   return Node;
 }
开发者ID:bkaradzic,项目名称:SwiftShader,代码行数:9,代码来源:xray-stacks.cpp

示例6: add

void add(string term){
	if(terms.find(term) == terms.end()){
		node *n = new node;
		n->t=term;
		n->i=1;
		termStack.push_front(*n);
		terms[term]=&termStack.front();			
	}
	else{
		terms[term]->i++;
	}
}
开发者ID:reallistic,项目名称:Puzzle-Solutions,代码行数:12,代码来源:FreqCount+EN.cpp

示例7: rReverse

void rReverse(std::forward_list<int> &l){
	
	if(!l.empty()){
		 a = l.front();

		l.pop_front();  //Remove all elements until empty

		rReverse(l); 
	}else{

		l.push_front(a); //Insert elements from the function stack
		
	}
	
}
开发者ID:rand0wn,项目名称:ask-dsa,代码行数:15,代码来源:reverseLL.cpp

示例8:

// TraialPool::get_traials() specialization for STL std::forward_list<>
template<> void
TraialPool::get_traials(std::forward_list< Reference<Traial> >& flist,
						unsigned numTraials)
{
	assert(0u < numTraials);
	numTraials++;  // loop guard condition requires this increment
	retrieve_traials:
	while (!available_traials_.empty() && 0u < --numTraials) {
		flist.push_front(available_traials_.front());
		available_traials_.pop_front();
	}
	if (0u < numTraials) {
		ensure_resources(std::max<unsigned>(numTraials++, sizeChunkIncrement));
		goto retrieve_traials;
	}
}
开发者ID:raulmonti,项目名称:FIG,代码行数:17,代码来源:TraialPool.cpp

示例9: getCombatArea

void Combat::getCombatArea(const Position& centerPos, const Position& targetPos, const AreaCombat* area, std::forward_list<Tile*>& list)
{
	if (targetPos.z >= MAP_MAX_LAYERS) {
		return;
	}

	if (area) {
		area->getList(centerPos, targetPos, list);
	} else {
		Tile* tile = g_game.map.getTile(targetPos);
		if (!tile) {
			tile = new StaticTile(targetPos.x, targetPos.y, targetPos.z);
			g_game.map.setTile(targetPos, tile);
		}
		list.push_front(tile);
	}
}
开发者ID:krugerdevelopers,项目名称:forgottenserver,代码行数:17,代码来源:combat.cpp

示例10: rReturn

//Using recursion
int rReturn(std::forward_list<int> l, int n){

    static int i = 0;

	if(i == n)
 	return l.front();

	if(!l.empty())
		
	{
	int a = l.front();
	
	l.pop_front();

	rReturn(l, n);
	
	l.push_front(a);

	i++;
	
     }
	
}
开发者ID:rand0wn,项目名称:ask-dsa,代码行数:24,代码来源:Nnode.cpp

示例11: AddDestruct

 /**
  * Add a #Window to the "destruct" list: the object will be deleted
  * by calling the class's Clear() method.  This means that the caller
  * doesn't have to keep track of the specified Window, because this
  * SubForm is now responsible for freeing memory.
  * Clear() must be called before deleting this form to delete windows
  * in the list.
  */
 void AddDestruct(Window *window) {
   destruct_windows.push_front(window);
 }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:11,代码来源:SubForm.hpp

示例12: boardToList

void Board::boardToList(int ri, int ci, int rn, int cn, std::forward_list<Board*> & l)
{
	Board*b = new Board(this);
        exch(b->blocks, ri, ci, rn, cn);
	l.push_front(b);
}
开发者ID:den4ix,项目名称:8puzzle,代码行数:6,代码来源:Board.cpp

示例13: connect

 inline void connect(const slot_t& f) // O(1)
 {
   slots.push_front(f);
 }
开发者ID:ftk,项目名称:niceamx,代码行数:4,代码来源:signal.hpp

示例14:

static void
fbsd_add_vfork_done (ptid_t pid)
{
  fbsd_pending_vfork_done.push_front (pid);
}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:5,代码来源:fbsd-nat.c

示例15: good_push_front_forward_list1

void good_push_front_forward_list1(std::forward_list<int> &FL, int n) {
  auto i0 = FL.cbegin(), i1 = FL.cend();
  FL.push_front(n);
  *i0; // no-warning
}
开发者ID:LegalizeAdulthood,项目名称:clang,代码行数:5,代码来源:invalidated-iterator.cpp


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