[Development] Container benchmark was HEADS UP: Don't use QList, use Q_DECLARE_TYPEINFO

Marc Mutz marc.mutz at kdab.com
Fri Jul 17 14:02:28 CEST 2015


On Friday 17 July 2015 12:07:22 André Somers wrote:
> Marc Mutz schreef op 17-7-2015 om 12:21:
> > What might also be a consideration when making a container like this, is
> > that I find the key is often (not always of course) already part of the
> > value data structure. For instance, if I store employee records and key
> > them by id, that id is also in the record itself. It would be nice to
> > have a fast and friendly key-based container that could handle that
> > without duplicating the data...
> > You can have that with C++11 std::*set, and a custom transparent
> > comparator, but of course, they are not cache-friendly. But it's
> > testament to the value of having the ability to _have_ a custom
> > comparator. QFashHash consequently has that ability, but its a map, not
> > a set, so it won't fit your use-case.
> 
> I guess this [1] would work, but that is C++14, not 11. Otherwise, I
> don't quite see how to retreive my Employee record again if I just have
> the id...
> 
> André
> 
> [1] http://en.cppreference.com/w/cpp/container/set/find variants 3 and 4

Yes, I meant those. Sorry, I thought they were C++11.

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list