473,503 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Removing all elements from STL queue

I am using an STL queue ( on top of a vector ).

queue < BroadcastBuffer*, vector <BroadcastBuffer*> > queue;

Is there anyway of flushing the queue - clear() is not available.

Sep 29 '05 #1
1 8047

"Tommo" <ma**********@citigroup.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I am using an STL queue ( on top of a vector ).

queue < BroadcastBuffer*, vector <BroadcastBuffer*> > queue;

Is there anyway of flushing the queue - clear() is not available.


#include <iostream>
#include <queue>

int main()
{
std::queue<int> q;
q.push(42);
std::cout << q.size() << '\n';

q = std::queue<int>();
std::cout << q.size() << '\n';

return 0;
}

-Mike
Sep 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2295
by: Tino | last post by:
I have a std::vector<int> which, after some initialization, has a fixed number of elements...after initialization I must do the following repeatedly: I remove an element which could be anywhere in...
6
7988
by: Jason Heyes | last post by:
What is a good way of removing elements from std::vector so that the elements removed satisfy a predicate and end up stored in another std::vector. It seems as though the algorithm std::remove_if...
2
1415
by: Graham | last post by:
Hi all, I'm trying to clean up the output from Word that has been pasted into a textarea. I'm purging much of the html (all styles, attributes etc) and would also like to remove things like...
7
2089
by: Adam Hartshorne | last post by:
Hi All, I was wondering if somebody could tell me if there is an efficient way to do the following. Say I have a list(or vector) A and a list B, I want to remove any elements in B, that are also...
2
1699
by: Adam Hartshorne | last post by:
Hi All, I was wondering if somebody could tell me if there is an efficient way to do the following. Say I have a list(or vector) A and a list B, I want to remove any elements in B, that are also...
6
1520
by: Alien | last post by:
According to MSDN, removing elements invalidates only those iterators that had specifically pointed at the removed elements. But I tried following codes, and find that without the repeated...
11
1970
by: kaferro | last post by:
I cannot relieve that I am working on Thanksgiving, but I am stuck over something that should be simple. I have a vector that has twenty-four elements. I need to remove the four elements whose...
10
6049
by: arnuld | last post by:
WANTED: /* C++ Primer - 4/e * * Exercise: 9.26 * STATEMENT * Using the following definition of ia, copy ia into a vector and into a list. Use the single iterator form of erase to...
2
1403
by: =?Utf-8?B?VG9kZCBCZWF1bGlldQ==?= | last post by:
Hello, I have a list of elements and I want to perform an operation on a subset of them and then remove them from the list. If I build a sequence of elements via LINQ to drive the enumeration, as...
5
1636
Aimee Bailey
by: Aimee Bailey | last post by:
In a library I am writing, I wish to stop people from removing item's from an List<> collection, is there an alternative or a way of overloading the Remove method that would stop other developers...
0
7204
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7091
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7282
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7342
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7464
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5586
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
741
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
391
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.