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


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

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


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

示例1: FilterTargets

            void FilterTargets(std::list<Unit*>& targetList)
            {
                // get 2 targets except 2 nearest
                targetList.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));

                // .resize() runs pop_back();
                if (targetList.size() > 4)
                    targetList.resize(4);

                while (targetList.size() > 2)
                    targetList.pop_front();
            }
开发者ID:AlenWalker,项目名称:Dragon,代码行数:12,代码来源:boss_rotface.cpp

示例2: Unmarshal

Error SNMPGetPacket::Unmarshal(std::list<Byte> &from) {
	set_type(static_cast<SNMPDataType>(from.front()));
	from.pop_front();

	//Byte length = from.front();
	from.pop_front();

	Error err{};

	if ((err = version_.Unmarshal(from)) != Error::None) {
		return err;
	}
	if ((err = community_string_.Unmarshal(from)) != Error::None) {
		return err;
	}
	if ((err = pdu_.Unmarshal(from)) != Error::None) {
		return err;
	}

	return Error::None;
}
开发者ID:gelidus,项目名称:isasnmp,代码行数:21,代码来源:SNMPPacket.cpp

示例3: ProcessTokens

 bool ProcessTokens(std::list<std::string> &tokens) {
   assert(0 == name_.compare(tokens.front()) && "option name is mismatched");
   if (1 == tokens.size()) {
     tokens.pop_front();
     is_set_ = true;
     return true;
   } else if (2 == tokens.size()) {
     tokens.pop_front();
     if (tokens.front() == "1") {
       is_set_ = true;
       tokens.pop_front();
       return true;
     } else if (tokens.front() == "0") {
       is_set_ = false;
       tokens.pop_front();
       return true;
     }
   }
   error() << "error: invalid option: '" << name_ << "'" << std::endl;
   return false;
 }
开发者ID:RadeonOpenCompute,项目名称:ROCR-Runtime,代码行数:21,代码来源:amd_options.hpp

示例4:

    bool
    OptionParser::processElement(std::list<std::string>& args)
    {
      std::string arg = args.front();
      args.pop_front();

      // Check for positional arguments.
      if (m_option_map.find(arg) == m_option_map.end())
      {
        if (arg[0] == '-')
        {
          m_error = String::str(DTR("unknown option '%s'"), arg.c_str());
          return false;
        }

        m_arguments.push_back(arg);
      }
      // Check for options.
      else
      {
        if (m_option_map[arg]->argument_label != "")
        {
          if (args.empty())
          {
            m_error = String::str(DTR("missing argument for option '%s'"), arg.c_str());
            return false;
          }

          std::string opt_arg = args.front();
          args.pop_front();
          m_option_map[arg]->argument = opt_arg;
        }
        else
        {
          m_option_map[arg]->argument = "true";
        }
      }

      return true;
    }
开发者ID:carlos-felipe88,项目名称:dune,代码行数:40,代码来源:OptionParser.cpp

示例5: reverseSecond

void reverseSecond( std::list<double> &d) {
  if(d.size() >= 1)
    {
      double temp1=d.front();
      double temp2=d.back();
      d.pop_front();
      d.pop_back();
      reverseSecond(d);
      d.push_front(temp2);
      d.push_back(temp1);
    }

}
开发者ID:nianxiaohu,项目名称:rpi_data_structure,代码行数:13,代码来源:list.cpp

示例6: pop

        optional<OnlineFileRequest*> pop() {
            if (queue.empty()) {
                return optional<OnlineFileRequest*>();
            }

            if (queue.begin() == firstLowPriorityRequest) {
                firstLowPriorityRequest++;
            }

            OnlineFileRequest* next = queue.front();
            queue.pop_front();
            return optional<OnlineFileRequest*>(next);
        }
开发者ID:jingsam,项目名称:mapbox-gl-native,代码行数:13,代码来源:online_file_source.cpp

示例7: popEvent

Event InputHandlerImpl::popEvent()
{
    eqMutex.lock();
    if(eventQueue.empty())
    {
        eqMutex.unlock();
        return Event(); //Default constructed event
    }
    Event result=eventQueue.front();
    eventQueue.pop_front();
    eqMutex.unlock();
    return result;
}
开发者ID:fedetft,项目名称:mxgui,代码行数:13,代码来源:event_win.cpp

示例8: DoPulse

///////////////////////////////////////////////////////////////
//
// CPerfStatSqliteTimingImpl::DoPulse
//
//
//
///////////////////////////////////////////////////////////////
void CPerfStatSqliteTimingImpl::DoPulse()
{
    long long llTime = GetTickCount64_();
    // Remove old stats
    while (m_TimingList.size())
    {
        CTimingInfo& info = m_TimingList.front();
        int          iAgeSeconds = static_cast<int>((llTime - info.timeStamp) / 1000);
        if (iAgeSeconds < 2000 && m_TimingList.size() < 1000)
            break;
        m_TimingList.pop_front();
    }
}
开发者ID:ccw808,项目名称:mtasa-blue,代码行数:20,代码来源:CPerfStat.SqliteTiming.cpp

示例9: CleanUpContexts

void ModeMapTest::CleanUpContexts(std::list<cl_context> &contexts, gmac::opencl::lite::ModeMap &map)
{
    while(contexts.empty() != false) {
        ASSERT_TRUE(map.get(contexts.front()) != NULL);
        gmac::opencl::lite::ModeMap::iterator it;
        it = map.find(contexts.front());
        ASSERT_TRUE(it != map.end());
        map.erase(it);
        ASSERT_TRUE(map.get(contexts.front()) == NULL);
        ASSERT_EQ(CL_SUCCESS, clReleaseContext(contexts.front()));
        contexts.pop_front();
    }
}
开发者ID:GMAC-lib,项目名称:gmac,代码行数:13,代码来源:ModeMap.cpp

示例10: _create

void mempool::_create(size_t al, char* v, char* en, 
            std::list<size_t> sizes, std::list<size_t> vsizes, std::list<char* >& ptrl) 
    {
        if(sizes.empty()){
            return;
        }
        if(v >= en){
            throw std::bad_alloc();
        }
        while(uintptr_t(v) % al){
            v++;
            if(v >= en){
                throw std::bad_alloc();
            }
        }
        size_t cur_size = sizes.front()*vsizes.front();
        sizes.pop_front();
        vsizes.pop_front();
        ptrl.push_back((char*)v);
        v+= cur_size;
        _create(al, v, en, sizes, vsizes, ptrl);
    }
开发者ID:UW-Kutz-Lab,项目名称:LILAC-backup,代码行数:22,代码来源:mempool.cpp

示例11: while

void merge_sort<T>::merge(std::list<T>& input1, std::list<T>& input2, size_t merge_depth, std::list<T>& out1, std::list<T>& out2)
{
    size_t merged1 = 0, merged2 = 0;
    std::list<T> *current = &out1;
    while (input1.size() > 0 && input2.size() > 0)
    {
        if (input1.front() <= input2.front())
        {
            current->push_back(input1.front());
            input1.pop_front();
            merged1++;
        }
        else
        {
            current->push_back(input2.front());
            input2.pop_front();
            merged2++;
        }

        if (merged1 == merge_depth)
        {
            while(input2.size() > 0 && merged2 < merge_depth)
            {
                current->push_back(input2.front());
                input2.pop_front();
                merged2++;
            }
        }

        if (merged2 == merge_depth)
        {
            while(input1.size() > 0 && merged1 < merge_depth)
            {
                current->push_back(input1.front());
                input1.pop_front();
                merged1++;
            }
        }

        if (merged1 == merge_depth || merged2 == merge_depth)
        {
            merged1 = merged2 = 0;
            if (current == &out1)
                current = &out2;
            else
                current = &out1;
        }
    }
    while (input1.size() > 0)
    {
        current->push_back(input1.front());
        input1.pop_front();
    }
    while (input2.size() > 0)
    {
        current->push_back(input2.front());
        input2.pop_front();
    }
}
开发者ID:yibing-shi,项目名称:YibingTest,代码行数:59,代码来源:ex_merge_sort.hpp

示例12: first_done

		void first_done(int status, hostent *ent) {
			if( status == ARES_SUCCESS ) {
				DebugTracePrintf(("Request result returned:%p -> %s:%d.%d.%d.%d",this,ent->h_name,ent->h_addr[0],ent->h_addr[1],ent->h_addr[2],ent->h_addr[3]));
			} else {
				DebugTracePrintf(("Request result error returned:%p",this));
			}
			if( _queue.begin() == _queue.end() )
				return;
			QueueEntry *f = *_queue.begin();
			_queue.pop_front();
			f->cb(f->arg,status,0,ent);
			delete f;
		}
开发者ID:h1048576,项目名称:libcurl,代码行数:13,代码来源:fake-ares.cpp

示例13: FilterTargets

            void FilterTargets(std::list<WorldObject*>& targets)
            {
                targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));

                // Selects 5 nearest dummies, including the caster
                // .resize() runs pop_back();
                if (targets.size() > 5)
                    targets.resize(5);

                // Selects 2 farthest ones to cast a spell
                while (targets.size() > 2)
                    targets.pop_front();
            }
开发者ID:mynew,项目名称:Core,代码行数:13,代码来源:boss_rotface.cpp

示例14: calc_avg

float calc_avg(float new_angle, std::list<float> &list){
        float sum = 0;
        //angle_error_vector.push_back(new_angle_error);
        list.push_back(new_angle);
        if(list.size() > 10){
                list.pop_front();
        }

        for(std::list<float>::iterator it = list.begin(); it != list.end(); ++it) {
                sum+=*it;
        }
        return sum/(signed)list.size();
}
开发者ID:sdsuvei,项目名称:navigation_test,代码行数:13,代码来源:line_calculation_node.cpp

示例15: traceInst

/**
* This function is called
**/
void traceInst(INS ins, VOID*)
{
    ADDRINT address = INS_Address(ins);

    std::string mod_name = getModule( address );
    RegList regs;

    for ( UINT32 i = 0; i < INS_OperandCount(ins); i++ )
    {
        if ( INS_OperandIsReg(ins, i) )
        {
            REG x = INS_OperandReg(ins, i);
            if ( x != REG_INVALID() )
                regs.push_back( x );
        }
    }

    if (isUnknownAddress(address))
    {
        // The address is an address that does not belong to any loaded module.
        // This is potential shellcode. For these instructions a callback
        // function is inserted that dumps information to the trace file when
        // the instruction is actually executed.

        INS_InsertCall(ins, IPOINT_BEFORE, AFUNPTR(dump_shellcode),
                       IARG_PTR, new std::string(dumpInstruction(ins)),
                       IARG_PTR, &regs,
                       IARG_CONTEXT, IARG_END
            );
    }
    else
    {
        if ( !modlist.empty() && (modlist.find(mod_name) == modlist.end()) ) // not concerned
            return;

        // The address is a legit address, meaning it is probably not part of
        // any shellcode. In this case we just log the instruction to dump it
        // later to show when control flow was transfered from legit code to
        // shellcode.

        legitInstructions.push_back(dumpInstruction(ins));

        if (legitInstructions.size() > KnobMaxLegitInsLogSize.Value())
        {
            // Log only up to KnobMaxLegitInsLogSize.Value() instructions or the whole
            // program before the shellcode will be dumped.

            legitInstructions.pop_front();
        }
    }
}
开发者ID:DaviWei,项目名称:pin-tools,代码行数:54,代码来源:shellcode.cpp


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