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


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

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


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

示例1: evaluate_unary_operator

bool evaluate_unary_operator(const object& operator_object,bool expand = true)
{
    object result, arg;
    bool eval = true;

    if(optic_stack.size())
    {
        eval = evaluate_top();

        if(eval)
        {
            arg = optic_stack.back();
            optic_stack.pop_back();

            if(arg.type == ARRAY && expand)
            {
                object new_array = mem_alloc(ARRAY);

                for(int i = 0; i < arg.data.array->size(); ++i)
                {
//                    optic_stack.push_back(mem_copy(arg.data.array->at(i)));
                    optic_stack.push_back(arg.data.array->at(i));
                    optic_stack.push_back(operator_object);

                    if(evaluate_top())
                    {
                        new_array.data.array->push_back(mem_copy(optic_stack.back()));
                        optic_stack.pop_back();
                    }

                }

                result = new_array;
            }

            else
            {
                operator_object.data.unary_operator_func(result, arg);
            }

//            mem_free(arg);
            optic_stack.push_back(result);
            return true;
        }
    }

    else
    {
        eval = false;
    }

    if(!eval)
    {
        mem_free(arg);
        out() << "Missing argument for unary operator" << std::endl;
        clear_stack();
        return false;
    }
}
开发者ID:GlitchLich,项目名称:Panopticon,代码行数:59,代码来源:stack.cpp

示例2: unwindTokens

 static void unwindTokens(std::deque<int>& queue, int tok) {
   assert(!queue.empty() && "Token stack is empty!");
   while (queue.back() != tok) {
     queue.pop_back();
     assert(!queue.empty() && "Token stack is empty!");
   }
   queue.pop_back();
 }
开发者ID:abhinavmoudgil95,项目名称:root,代码行数:8,代码来源:InputValidator.cpp

示例3: push

 void push(int x) {
   while(!stackB.empty()){
     stackA.push_back(stackB.back());
     stackB.pop_back();
   }
   stackA.push_back(x);
   while(!stackA.empty()){
     stackB.push_back(stackA.back());
     stackA.pop_back();
   }
 }
开发者ID:riddlexu,项目名称:leetcode_exercise,代码行数:11,代码来源:implement_queue_with_stacks.cpp

示例4: main

int main(){
	//freopen("sun.in","r",stdin);
	//freopen("sun.out","w",stdout);
	scanf("%d",&n);
	scanf("%s",s);
	for (int i = 0; i < n; ++i){
		q.push_back(s[i]);
	}
	while(!q.empty()){
		if(q.front()<q.back()){
			putchar(q.front());
			q.pop_front();
		}else if(q.front()>q.back()){
			putchar(q.back());
			q.pop_back();
		}else{
			if(q.size()==1){
				putchar(q.front());
				break;
			}
			while(q.front()==q.back() && q.size()!=1){
				lq.push_back(q.front());
				rq.push_back(q.front());
				if(q.front()>q.back()){
					while(!rq.empty()){
						putchar(rq.front());
						rq.pop_front();
					}
					putchar(q.back());
					q.pop_back();
					while(!lq.empty()){
						q.push_front(lq.back());
						lq.pop_back();
					}
				}else{
					while(!rq.empty()){
						putchar(rq.front());
						rq.pop_front();
					}
					putchar(q.back());
					q.pop_front();
					while(!lq.empty()){
						q.push_back(lq.back());
						lq.pop_back();
					}
				}
			}

			
		}
	}
	putchar('\n');
	return 0;
}
开发者ID:cjsoft,项目名称:noip,代码行数:54,代码来源:sun.cpp

示例5: align_back

static void align_back(const std::deque<timestamp_t> &reference,
                       std::deque<timestamp_t> &target,
                       std::deque<vec3_t> &data) {
  const auto back = reference.back();
  while (true) {
    if (target.back() > back) {
      target.pop_back();
      data.pop_back();
    } else {
      break;
    }
  }
}
开发者ID:chutsu,项目名称:prototype,代码行数:13,代码来源:measurement.cpp

示例6: return

JNIEXPORT jchar JNICALL
Java_link_kjr_SimpleTerminal_MainActivity_get_1char__(JNIEnv *env, jclass type) {
    char f=buffer.back();
    buffer.pop_back();
    return (jchar) f;

}
开发者ID:suchones,项目名称:SimpleTerminal,代码行数:7,代码来源:init_shell.cpp

示例7: qread

 int qread() {
   if (m_deq.empty())
     return super_t::read();
   unsigned char c = m_deq.back();
   m_deq.pop_back();
   return c;
 }
开发者ID:biochem-fan,项目名称:cuemol2,代码行数:7,代码来源:ChunkDelimFilter.hpp

示例8: main

int main() {
    while (~scanf("%d %d", &n, &m)) {
        init(n);
        for (int i = 1; i <= n; ++i) {
            scanf("%I64d", s + i);
            s[i] += s[i - 1];
        }
        dp[1] = s[1] * s[1] + m;
        q.push_back(0);
        for (int i = 1; i <= n; ++i) {
            while (q.size() >= 2 && Up(q[1], q.front()) <= s[i] * Down(q[1], q.front())) {
                // printf("  %d\n", q[1]);
                // printf("--- %I64d %d\n", dp[i], q.size());
                q.pop_front();
            }
            if (!q.empty())
                Dp(i, q.front());
            // printf("%I64d %d\n", dp[i], q.size());
            while (q.size() >= 2 /*&& 1, printf("--- %I64d %d\n *** %I64d %I64d\n", dp[i], q.back(), Up(i, q.back()) * Down(q.back(), q[q.size() - 2]), Up(q.back(), q[q.size() - 2]) * Down(i, q.back())) */&& Up(i, q.back()) * Down(q.back(), q[q.size() - 2]) <= Up(q.back(), q[q.size() - 2]) * Down(i, q.back())) {
                // ;
                // printf("  %d\n", q[1]);
                q.pop_back();
            }
            q.push_back(i);
                // printf("  %d\n", q.size());
        }
        printf("%I64d\n", dp[n]);
    }
}
开发者ID:cjsoft,项目名称:noip,代码行数:29,代码来源:hdu2507.cpp

示例9: dijkstra_LIFO_thread

void dijkstra_LIFO_thread(CSRGraph *g, int *dist, std::deque<int> &deq, int threadNum, int *onstack, std::mutex *dist_locks)
{
    while(!deq.empty())
    {
        queue_lock.lock();

        if(deq.empty()){
            queue_lock.unlock();
            break;
        }

        int u = deq.back();
        deq.pop_back();
	
    printf("Popped\n");
    for(int i=0; i< deq.size();i++){
	printf(" %d", deq[i]);
    }
    printf("\n");
        onstack[u]=0;

        int udist = dist[u];
        queue_lock.unlock();

        std::vector<int> neighbors = CSRGraph_getNeighbors(g, u);
        int neighbor;
        for(neighbor=0;neighbor < neighbors.size(); neighbor++)
        {
            int v = neighbors[neighbor];
            int uvdist = CSRGraph_getDistance(g, u, v);
            int alt = udist + uvdist;

            dist_locks[v].lock();
            if(alt < dist[v])
            {
                dist[v] = alt;
                dist_locks[v].unlock();

                queue_lock.lock();                
                if(onstack[v] == 0) 
                {
                    deq.push_back(v);
		    
    printf("Pushed\n");
    for(int i=0; i< deq.size();i++){
	printf(" %d", deq[i]);
    }
    printf("\n");
                    onstack[v]=1;
                }
                queue_lock.unlock();                    
            }
            else
            {
                dist_locks[v].unlock();
            }
        }
    }
    //printf("Thread %d ended.\n", threadNum);
}
开发者ID:natahlieb,项目名称:Programming-for-Performance,代码行数:60,代码来源:main.cpp

示例10: dequeBack

			value_type dequeBack()
			{
				libmaus2::parallel::ScopePosixSpinLock llock(lock);
				value_type const v = Q.back();
				Q.pop_back();
				return v;
			}
开发者ID:dkj,项目名称:libmaus2,代码行数:7,代码来源:LockedQueue.hpp

示例11: maximumContiguousSum

int maximumContiguousSum(std::deque<int> &numbers) {
  int max = 0;
  std::deque<int>::iterator boundary;
  std::deque<int>::iterator adder;
  while (numbers.size() > 0) {
    for (boundary = numbers.end(); boundary != numbers.begin(); boundary--) {
      int testSum = 0;
      for (adder = numbers.begin(); adder != boundary; adder++) {
        testSum += *adder; 
      }
      if (testSum > max) { max = testSum; }
    }
    for (boundary = numbers.begin(); boundary != numbers.end(); boundary++) {
      int testSum = 0;
      for (adder = boundary; adder != numbers.end(); adder++) {
        testSum += *adder;
      }
      if (testSum > max) { max = testSum; }
    }
    if (!numbers.empty()) { numbers.pop_back(); }
    if (!numbers.empty()) { numbers.pop_front(); }
    if (numbers.size() == 1) {
      if (numbers.at(0) > max) { max = numbers.at(0); }
    }
  }
  return max;
}
开发者ID:loadstar81,项目名称:brainfood,代码行数:27,代码来源:017sumofintegers.cpp

示例12: disambiguate

static inline void propagate_age_update(Cfg& conf, std::deque<Cfg>& tmpres, std::size_t dst) {
	// here we propagate an age field update to all pointers that are equal
	// and thus experience the update too => only for age updates of next fields

	// split to find truly equal pointers
	auto shape_split = disambiguate(*conf.shape, dst);

	for (Shape* s : shape_split) {
		tmpres.emplace_back(Cfg(conf, s));
		Cfg& config = tmpres.back();

		// pointer equal to dst => experiences age update too
		for (std::size_t i = 0; i < s->size(); i++) {
			if (i == dst) continue;
			if (s->test(i, dst, EQ)) {
				#if CAS_OVERAPPROXIMATE_AGE_PROPAGATION
					// overapproximation: drop age relation of pointers that observe the age assignemnt
					for (std::size_t j = 0; j < s->size(); j++)
						for (bool b : {false, true})
							config.ages->set(j, b, i, true, AgeRel::BOT);
				#else
					mk_next_age_equal(config, i, dst, true);
				#endif
			}
		}
	}

	// the shape/ages from conf may no longer be valid => overwrite the shape/ages
	conf.shape = std::move(tmpres.back().shape);
	conf.ages = std::move(tmpres.back().ages);
	tmpres.pop_back();
}
开发者ID:Wolff09,项目名称:TMRexp,代码行数:32,代码来源:eval_cas.cpp

示例13: hier_pop_mat

void hier_pop_mat()
{
    if (!matrix_stack.empty())
    {
        current_mat=matrix_stack.back();
        matrix_stack.pop_back();
    }
}
开发者ID:Jisby,项目名称:TuxRacer-SDL2,代码行数:8,代码来源:hier_util.cpp

示例14: set

 // set key and value
 size_t set(const Key& k, const Value&& v) {
   if( data_.count(k) ) return data_.size();
   cache_.push_back(k);
   while (!max_cache_.empty() && max_cache_.back() < k) max_cache_.pop_back();
   max_cache_.push_back(k);
   data_[k] = std::move(v);
   return data_.size();
 }
开发者ID:eduardonunesp,项目名称:iroha,代码行数:9,代码来源:map_queue.hpp

示例15: mouseDrag

void LineRenderingSampleApp::mouseDrag(MouseEvent event)
{
    mMousePositions.push_front(vec3(event.getPos(), 0.0f));
    if (mMousePositions.size() > mMaxMousePositions)
    {
        mMousePositions.pop_back();
    }
}
开发者ID:sansumbrella,项目名称:Pockets,代码行数:8,代码来源:LineRenderingSampleApp.cpp


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