Il 14/04/25 17:35, Volker Hilsheimer via Interest ha scritto:
As Thiago says, you have to use std::views::transform. In that case, you can 
put the QMap itself directly into the pipeline:

auto viewAsPair = map | std::views::transform(fTransform);

But you cannot use an rvalue as the input range (see 
e.g.https://en.cppreference.com/w/cpp/ranges/dangling). Make a copy first:

     auto keyValueRange = map.asKeyValueRange();
     auto viewAsPair = keyValueRange | std::views::transform(fTransform);

This is a bug. The type returned asKeyValueRange() is supposed to model ranges::view. It doesn't; it doesn't inherit from view_interface nor has enabled_view enabled for it, and it doesn't model std::moveable. This should be a subtask of QTBUG-105465.

My 2 c,
--
Giuseppe D'Angelo | giuseppe.dang...@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 - Trusted Software Excellence

Attachment: smime.p7s
Description: Firma crittografica S/MIME

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to