|
by: Dave |
last post by:
Hello all,
After perusing the Standard, I believe it is true to say that once you
insert an element into a std::list<>, its location in memory never changes.
This makes a std::list<> ideal for storing vertices of an arbitrary n-ary
tree where a vertex contain pointers to its parent / children. These parent
/ child vertices need to stay put if we've got pointers to them somewhere!
Am I correct in my assertion?
|
by: Morten Aune Lyrstad |
last post by:
Hi! I haven't been using the standard template libraries much. I have a hard
time trying to figure out just what is the practical difference between
std::vector and std::list. Aren't both basically a list of objects? Why the
two types? And most importantly of all: Which one is the faster? Is it
practical to use these in game programming for dynamic arrays, or are they
too slow?
Yours,
Morten Aune Lyrstad
|
by: William Payne |
last post by:
Ok, in my program I have a std::list<Document*>, where Document is one of my
own classes.
I need to go through this list and check each item if it's ready for
deletion. If it's not, skip to next, if it's ready I take steps to delete
it. The thing is that the list is part of a gui application and the system
removes the Document* from the list during the execution of the loop body.
That means I cant use iterators to iterate over the list....
|
by: Josh Mcfarlane |
last post by:
Just out of curiosity:
When would using std::list be more efficient / effective than using
other containers such as vector, deque, etc?
As far as I'm aware, list doesn't appear to be specialized for
anything.
Thanks,
Josh McFarlane
|
by: Markus Svilans |
last post by:
Hi,
There seems to be some functionality missing from the STL.
I am iterating through a linked list (std::list) using a reverse
iterator and attempting to erase certain items from the list. It is
important that I iterate through the list backwards, because the items
in it have to be processed in reverse order before erasing. However,
there does not appear to be an std::list::erase() method defined for
reverse iterators.
|
|
by: Tim Slattery |
last post by:
It would be convenient for my app to store the stuff I'm generating in
a std::list. I'd like to remember the location of a particular place
in the list - sort of like sticking my finger into it - and insert an
entry in that place some time later. There's an "insert" member
function, but it takes an iterator to designate the place to insert.
And I can't figure out how to get an iterator that points to the right
place. For instance:
...
|
by: SpreadTooThin |
last post by:
I want to replace an object in a list with a new object....
std::list<myObj>::iterator it;
for (it=mylist.begin(); it != mylist.end(); ++it)
{
if (it->compair(myval) == 0)
{
*it = newval;
}
|
by: desktop |
last post by:
Are there any case where iterators in a std::list gets invalidated
besides from the iterator pointing to an element thats deleted?
It seems that its only the std::vector that invalidates iterators
pointing to elements after a deleted element since its practically just
an array.
|
by: Juha Nieminen |
last post by:
If I'm not completely mistaken, the only reason why std::list::size()
may be (and usually is) a linear-time operation is because they want
std::list::splice() to be a constant-time operation, and if you execute
the latter, the size of the resulting lists cannot be known without
explicitly counting the sizes of the new lists.
I was thinking: What if size() was an O(n) operation only *after*
a splice() operation has been performed (and...
|
by: Mike Copeland |
last post by:
How do I work with a std::list that might have multiple objects
having the same "key", but which have other data that is different?
Here's code that compiles, but doesn't do quite what I expect:
(Please note that there's some specialized I/o code here, but the
logic flow should be clear...)
struct GenCheck // Gender Check data
{
char genCode;
int useCount;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|