On Friday 26 June 2015 19:59:37 Thiago Macieira wrote:
> On Friday 26 June 2015 16:45:18 Marc Mutz wrote:
> > or that they don't have range-ctor or range-insert, or emplace, or
> > allocator  support.
> 
[...]
> I tried to implement emplace, but didn't find much value because Qt
> containers require the type contained to be default constructible and will
> make copies in the future anyway.

QList does not require the type to be default-constructible. I think only 
QVector and QVarLengthArray do.

> As for allocators, I've been doing C++ for 20 years and I have never once
> ever used one. So that's a P6 "less than not important" task in my view.

I did:
  https://github.com/GPGTools/pinentry/blob/master/secmem/secmem%2B%2B.h

Used here:
  https://github.com/GPGTools/pinentry/blob/master/qt4/secstring.h

And with C++11/14 stateful allocators, I expect allocators to gain popularity: 
e.g. QVarLengthArray can be superseded by something like

    char pool[4096];
    pool_allocator<T> alloc(pool);
    std::vector<T, pool_allocator<T>> vec(alloc);
    // ...

which would allow local-memory maps, too:
    std::map<K, V, std::less<>, pool_allocator<std::pair<const K, V>>>
      map(alloc);

Yes, that's what template aliases were invented for :)

Last time I looked (long ago, 2.4-ish), QtC had a per-document memory pool, 
too. Don't remember how they handled container classes, though.

Thanks,
Marc

-- 
Marc Mutz <[email protected]> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts
_______________________________________________
Development mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to