Esempio n. 1
0
U foldr_dest(std::function< U (U, T)>& op, const U& val, std::forward_list<T>& L)
{
  if (L.empty()) return U(val);
  T h = L.front();
  L.pop_front();
  return op (foldr(op, val, L),  h);
}
void get(int k){
	termStack.sort(std::greater<node>());
	for(int i=0; i<k; i++){
		cout<<termStack.front().t<<endl;
		termStack.pop_front();
	}
}
Esempio n. 3
0
void
TraialPool::return_traials(std::forward_list< Reference< Traial > >& list)
{
	for (auto it = list.begin() ; it != list.end() ; it = list.begin()) {
		available_traials_.push_front(*it);
		list.pop_front();  // 'it' got invalidated
	}
}
		bool runDeferred() {
			__EVENTEMITTER_LOCK_GUARD(mutex);
			if(deferredQueue.empty()) {
				return false;
			}
			(deferredQueue.front())();
			deferredQueue.pop_front();
			return true;
		}
Esempio n. 5
0
static ptid_t
fbsd_next_vfork_done (void)
{
  if (!fbsd_pending_vfork_done.empty ())
    {
      ptid_t ptid = fbsd_pending_vfork_done.front ();
      fbsd_pending_vfork_done.pop_front ();
      return ptid;
    }
  return null_ptid;
}
Esempio n. 6
0
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
		
	}
	
}
Esempio n. 7
0
  /* virtual methods from class Notify */
  void OnNotification() override {
    const bool was_empty = items.empty();

    {
      const ScopeLock protect(mutex);

      if (new_items.empty())
        return;

      do {
        items.emplace_back(std::move(new_items.front()));
        new_items.pop_front();
      } while (!new_items.empty());
    }

    GetList().SetLength(items.size());

    if (was_empty)
      /* the list has just become non-empty, so allow pressing the
         "select" button */
      select_button->SetEnabled(true);
  }
Esempio n. 8
0
//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++;
	
     }
	
}
Esempio n. 9
0
int
exceptions_state_mc_catch (struct gdb_exception *exception,
			   int mask)
{
  *exception = std::move (catchers.front ().exception);
  catchers.pop_front ();

  if (exception->reason < 0)
    {
      if (mask & RETURN_MASK (exception->reason))
	{
	  /* Exit normally and let the caller handle the
	     exception.  */
	  return 1;
	}

      /* The caller didn't request that the event be caught, relay the
	 event to the next exception_catch/CATCH_SJLJ.  */
      throw_exception_sjlj (*exception);
    }

  /* No exception was thrown.  */
  return 0;
}
Esempio n. 10
0
 void pop() {
     data_.pop_front();
     mins_.pop_front();
 }
void bad_pop_front_forward_list1(std::forward_list<int> &FL, int n) {
  auto i1 = FL.cbegin(), i0 = i1++;
  FL.pop_front();
  *i0; // expected-warning{{Invalidated iterator accessed}}
}
void good_pop_front_forward_list1(std::forward_list<int> &FL, int n) {
  auto i1 = FL.cbegin(), i0 = i1++;
  FL.pop_front();
  *i1; // no-warning
}