qt-interest@trolltech.com
[Top] [All Lists]

Re: Différence of QStringLists

Subject: Re: Différence of QStringLists
From: Chris Thompson
Date: Tue, 31 Oct 2006 10:31:54 -0700
On Tuesday 31 October 2006 10:16, max wrote:
> Hello
>
> Is there a simple way to make the difference of two QStringLists ?
> I mean :
> QStringList list1 = a, b, c, d;
> QStringList list2 = b, c;
>
> and something like :
>
> QStringList res = list1 - list2;
>
> with
> res = a, d;

QStringList is a QValueList.  QValueList provides enough functionality to work 
as a container which you can apply STL algorithms against.  That means you 
could probably apply std::set_difference, though you'd have to sort your 
string list first (possibly qHeapSort).

I haven't tried this, though.

--
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/

<Prev in Thread] Current Thread [Next in Thread>