本文整理汇总了C++中queue::size方法的典型用法代码示例。如果您正苦于以下问题:C++ queue::size方法的具体用法?C++ queue::size怎么用?C++ queue::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类queue
的用法示例。
在下文中一共展示了queue::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: push_ourlqueue
static void push_ourlqueue(Url * ourl)
{
pthread_mutex_lock(&oq_lock);
ourl_queue.push(ourl);
if (ourl_queue.size() == 1)
pthread_cond_broadcast(&oq_cond);
pthread_mutex_unlock(&oq_lock);
}
示例2: showMeAdapterSizes
void showMeAdapterSizes(queue <Slav *> queue, stack <Slav *> stack)
{
printf("[queue_size = %lu, stack_size = %lu, existingSlavs = %i]\n",
queue.size(),
stack.size(),
Slav::counter());
}
示例3: push
// Push element x onto stack.
void push(int x) {
_.push(x);
for (int i = 0; i < _.size() - 1; i++)
{
_.push(_.front());
_.pop();
}
}
示例4: handDestroy
void XN_CALLBACK_TYPE handDestroy(HandsGenerator &generator, XnUserID user, XnFloat fTime, void *pCookie){
printf("hand destroy \n");
if (hand1ID == user) {
hand1ID = -1;
while (hand1.size() > 0) {
hand1.pop();
}
} else if (hand2ID == user) {
hand2ID = -1;
while (hand2.size() > 0) {
hand2.pop();
}
}
oldZoom = 1;
oldAngle = 0;
g_GestureGenerator.AddGesture(GESTURE_TO_USE, NULL);
}
示例5: pop
void Stack::pop(){
while(q1.size() != 1){
q2.push(q1.front());
q1.pop();
}
q1.pop();
swap(q1, q2);
}
示例6: handUpdate
void XN_CALLBACK_TYPE handUpdate(HandsGenerator &generator, XnUserID user, const XnPoint3D *pPosition, XnFloat fTime, void *pCookie){
if (hand1ID == user) {
if (hand1.size() > 2) {
hand1.pop();
}
hand1.push(*pPosition);
} else if (hand2ID == user) {
if (hand2.size() > 2) {
hand2.pop();
}
hand2.push(*pPosition);
}
//printf("handUpdate: x %f y %f z %f \n", pPosition->X, pPosition->Y, pPosition->Z);
}
示例7: pop
// Removes the element on top of the stack.
void pop() {
int len = my_que_A.size();
for(int i=0; i<len-1; i++) {
my_que_A.push(my_que_A.front());
my_que_A.pop();
}
my_que_A.pop();
}
示例8: main
int main(int argc, const char * argv[]) {
// insert code here...
url_t output_url;
output_url = parse_single_URL(argv[1]);
depth=atoi(argv[2]);
urlStruct init;
init.url=output_url;
urlQueue.push(init);
for (int i=0; i<10; i++) {
while(!urlQueue.empty()){
urlStruct nextUrl=urlQueue.front();
urlQueue.pop();
dataStruct temp1 = retrieveWebPage(nextUrl.url, nextUrl.depth);
if (temp1.data) {
dataQueue.push(temp1);
}
}
if (!dataQueue.empty()) {
std::cout<<"\n DATAQUEUE SIZE:"<<dataQueue.size()<<"\n";
dataStruct data=dataQueue.front();
dataQueue.pop();
parseWebPage(data);
std::cout<<"\n"<<urlQueue.size()<<"\n";
numberInQueue--;
}
}
return 0;
}
示例9: push
// Push element x onto stack.
void push(int x) {
size_t size = q.size();
q.push(x);
for( ; size > 0; --size ) {
int tmp = q.front();
q.pop();
q.push(tmp);
}
}
示例10: pop
// Removes the element on top of the stack.
void pop() {
queue<int> tmp;
int length = stack.size() - 1;
for (int i = 0; i < length; i++) {
tmp.push(stack.front());
stack.pop();
}
stack = tmp;
}
示例11: poo
string poo()
{
if (foodBuffer.size() == 0)
throw petHungryException;
string ans = foodBuffer.front();
foodBuffer.pop();
return ans;
}
示例12: main
int main(){
ios_base::sync_with_stdio(false);
cin >> h >> t >> r;
cin >> n;
for(int i = 1; i <= n; i++){
int fi, se;
cin >> fi >> se;
a[i] = MP(fi, se);
}
cin >> m;
for(int i = 1; i <= m; i++){
int fi, se;
cin >> fi >> se;
b[i] = MP(fi, se);
}
Q.push(MP(h, t));
mark[h][t] = true;
while(Q.size()){
pie v = Q.front();
Q.pop();
if(v == MP(0, 0)){
cout << "Ivan" << endl;
cout << he[0][0] << endl;
return 0;
}
for(int i = 1; i <= min(v.L, n); i++){
pie u = v;
u.L -= i;
u.L += a[i].L;
u.R += a[i].R;
if(mark[u.L][u.R])
continue;
if(u.L + u.R <= r){
he[u.L][u.R] = he[v.L][v.R] + 1;
mark[u.L][u.R] = true;
Q.push(u);
}
}
for(int i = 1; i <= min(v.R, m); i++){
pie u = v;
u.R -= i;
u.R += b[i].R;
u.L += b[i].L;
if(mark[u.L][u.R])
continue;
if(u.L + u.R <= r){
he[u.L][u.R] = he[v.L][v.R] + 1;
mark[u.L][u.R] = true;
Q.push(u);
}
}
}
dfs(MP(h, t));
cout << "Zmey" << endl
<< DP(MP(h, t)) << endl;
return 0;
}
示例13: pop
// Removes the element on top of the stack.
void pop() {
queue<int> tmp;
while(q.size() > 1){
int x = q.front();
q.pop();
tmp.push(x);
}
q = tmp;
}
示例14: pop
void pop(){
for(int i = 0; i<q.size()-1;i++)
{
int top = q.front();
q.pop();
q.push(top);
}
q.pop();
}
示例15: dequeue
void dequeue()
{
if(q1.size()==0)
{
cout<<"underflow"<<endl;
return;
}
while(q1.size()!=1)
{
q2.push(q1.front());
q1.pop();
}
cout<<"popped element"<<q1.back()<<endl;
q1.pop();
temp=q2;
q2=q1;
q1=temp;
}