Hi

I am using Qlist of objects of type MyObj in an instance of class AClass

Should I store the as a list of pointers to MyObj

Qt Code:
  1. QList <MyObj*> mylist;
To copy to clipboard, switch view to plain text mode 

The function to add items to my list is as follows

Qt Code:
  1. void AClass::addToList(const QList <MyObj> &items)
  2. {
  3. foreach(MyObj m, items)
  4. {
  5. MyObj mm = new MyObj(m);
  6. mylist.append(mm);
  7. }
  8. }
To copy to clipboard, switch view to plain text mode 

OR a list of MyObj instances and i add to the list as follows

Qt Code:
  1. QList <MyObj> mylist;
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. void AClass::addToList(const QList <MyObj> &items)
  2. {
  3. mylist.append(items);
  4. }
To copy to clipboard, switch view to plain text mode 

Which of the two cases above is the best way?

I have a problem removing items from the list as the MyObj class does not have a comparison operator

For example, I have a function to remove items from the list

Qt Code:
  1. void AClass::removeFromList(const QList <MyObj> &items)
  2. {
  3. foreach(MyObj m, items)
  4. {
  5. /*
  6.   what do I put in here if I want to remove 'items' from mylist
  7.   */
  8. }
  9. }
To copy to clipboard, switch view to plain text mode 

Regards