[Interest] Qt API annoyances: where to log/discuss?

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Wed Oct 31 21:30:28 CET 2018


Il 31/10/18 18:35, Jason H ha scritto:
> I attempted this recently, but failed to figure out how to do the following:
> QVector<int> triple = apply(QVector<int> {1,2,3},[](item) { return item*3;});
> or
> QVector<int> originals {1,2,3};
> QVector<int> triples = originals.apply([](item) { return item*3;});

You do this:

> std::vector<int> originals{1, 2, 3};
> std::vector<int> triples = originals | ranges::view::transform([](int i) { return i * 3; });

(modulo typos). Possibly even without the <int>, as std containers have 
CTAD.

Cheers,
-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4007 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181031/c8ccdc63/attachment.bin>


More information about the Interest mailing list