本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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;
}
示例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();
}
示例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();
}
示例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, ®s,
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();
}
}
}