Now, how to delete?
-
Please Refer Here[^] This doesn't work there:
if (mySObj_iter != lst_mySObj.end())
{
lst_mySObj.erase(*mySObj_iter);
}How do I do it?Overload any other operator?:confused: Error:
error C2664: 'std::list<_Ty>::_Iterator<_Secure_validation> std::list<_Ty>::erase(std::list<_Ty>::_Iterator<_Secure_validation>)' : cannot convert parameter 1 from 'myStruct' to 'std::list<_Ty>::_Iterator<_Secure_validation>' with [ _Ty=myStruct_t, _Secure_validation=true ]
*
-
Please Refer Here[^] This doesn't work there:
if (mySObj_iter != lst_mySObj.end())
{
lst_mySObj.erase(*mySObj_iter);
}How do I do it?Overload any other operator?:confused: Error:
error C2664: 'std::list<_Ty>::_Iterator<_Secure_validation> std::list<_Ty>::erase(std::list<_Ty>::_Iterator<_Secure_validation>)' : cannot convert parameter 1 from 'myStruct' to 'std::list<_Ty>::_Iterator<_Secure_validation>' with [ _Ty=myStruct_t, _Secure_validation=true ]
*
Astricks wrote:
lst_mySObj.erase(*mySObj_iter);
Did you even bother to read the MSDN helptext? Or a good Book? Josuttis, "The C++ Standard Library" and Myers, "Effective STL" are always within arms lenght here. The correct parameter is the iterator, not the object. So stop dereferencing the iterator and write
lst_mySObj.erase(mySObj_iter);
-- moified at 4:43 Monday 12th February, 2007 Clarification
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
-
Please Refer Here[^] This doesn't work there:
if (mySObj_iter != lst_mySObj.end())
{
lst_mySObj.erase(*mySObj_iter);
}How do I do it?Overload any other operator?:confused: Error:
error C2664: 'std::list<_Ty>::_Iterator<_Secure_validation> std::list<_Ty>::erase(std::list<_Ty>::_Iterator<_Secure_validation>)' : cannot convert parameter 1 from 'myStruct' to 'std::list<_Ty>::_Iterator<_Secure_validation>' with [ _Ty=myStruct_t, _Secure_validation=true ]
*
have you tried using this :
lst_mySObj.erase(mySObj_iter); //see, the iterator is not dereferenced
if i remember well,
erase()
gets an iterator, not an element of the vector also, if you're cleaning the whole vector, useclear()
instead
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
have you tried using this :
lst_mySObj.erase(mySObj_iter); //see, the iterator is not dereferenced
if i remember well,
erase()
gets an iterator, not an element of the vector also, if you're cleaning the whole vector, useclear()
instead
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]
-
Astricks wrote:
lst_mySObj.erase(*mySObj_iter);
Did you even bother to read the MSDN helptext? Or a good Book? Josuttis, "The C++ Standard Library" and Myers, "Effective STL" are always within arms lenght here. The correct parameter is the iterator, not the object. So stop dereferencing the iterator and write
lst_mySObj.erase(mySObj_iter);
-- moified at 4:43 Monday 12th February, 2007 Clarification
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
-
Astricks wrote:
lst_mySObj.erase(*mySObj_iter);
Did you even bother to read the MSDN helptext? Or a good Book? Josuttis, "The C++ Standard Library" and Myers, "Effective STL" are always within arms lenght here. The correct parameter is the iterator, not the object. So stop dereferencing the iterator and write
lst_mySObj.erase(mySObj_iter);
-- moified at 4:43 Monday 12th February, 2007 Clarification
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
-
Astricks wrote:
So the panic.
No Problem. I followed your link only after my post, to see that you are actually caring for the answers. Therefore I was pointing you to the documentation before answerinf your question. But really, the Josuttis helps greatly when working with the STL. And the Myers is great in giving lectures about dos and donts with the STL.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
-
Astricks wrote:
lst_mySObj.erase(*mySObj_iter);
Did you even bother to read the MSDN helptext? Or a good Book? Josuttis, "The C++ Standard Library" and Myers, "Effective STL" are always within arms lenght here. The correct parameter is the iterator, not the object. So stop dereferencing the iterator and write
lst_mySObj.erase(mySObj_iter);
-- moified at 4:43 Monday 12th February, 2007 Clarification
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
I dont know why you get low vote I give 5 to you ;)
WhiteSky
-
I dont know why you get low vote I give 5 to you ;)
WhiteSky
Someone does not share my taste in books? :-D Anyway - thanks! :rose:
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
-
Someone does not share my taste in books? :-D Anyway - thanks! :rose:
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
Sometimes I going to meet of new ideas on your mail you answer and suggest a book to him its worth:-D
WhiteSky
-
Someone does not share my taste in books? :-D Anyway - thanks! :rose:
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.
or maybe just the way you suggested it, implying that the OP didn't search first. i personnaly found the tone of your post a bit aggressive, so i can understand someone else did too...
[VisualCalc][Flags Beginner's Guide] | [Forums Guidelines][My Best Advice]