deanfamily said:
I am re-posting my second problem.
I have a double-linked list. I need to know if it is possible to remove just
one of an item, instead of all that match the given criteria with the
remove() command. Any thoughts?
I think that you are not getting many replies because you are not being
very specific. What is a "double-linked list" to you? We all know what
that is, but what does your specific implementation look like? Are you
using std::list? Are you using some list class that you rolled on your
own? If so, give enough detail about it that we can converse
intelligently and write code that doesn't make assumptions about what we
are working with.
What do you mean by "the remove() command"? Do you mean std::remove()?
Do you mean std::list<>::remove()?
If I wanted to remove the first item from a list that matched a
criteria, I would use a command like the following.
std::list<int>::iterator i = std::find(numbers.begin(), numbers.end(),
value) ;
if (i != number.end()) numbers.erase(i) ;
Notice how many assumptions I've just made. I've assumed you are using
std::list. I've assumed that you are storing a list of type int. I've
assumed your list is called numbers, and a variable called value
containes the value you want to remove. It is very unlikely that all of
my assumptions are true. If some of the more fundamental ones (like you
using std::list) are not true, then my answer can barely even apply to
your situation.
The more specific you are with your questions, the more likely you are
to get help.
Alan