> Il 14/04/25 17:35, Volker Hilsheimer via Interest ha scritto:
> > As Thiago says, you have to use std::views::transform.

Sorry, that was a typo. Corrected example using asKeyValueRange: 
https://godbolt.org/z/fT4G9TnKW

> In that case, you can put the QMap itself directly into the pipeline:
> >
> > auto viewAsPair = map | std::views::transform(fTransform);
> >

Passing the map directly only gives me the values, not the keys, see 
https://godbolt.org/z/jEahnWMT3

> 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);> >
> >      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.

I tend to agree.

Kind regards

Robert
________________________________

This message and any attachments are solely for the use of the intended 
recipients. They may contain privileged and/or confidential information or 
other information protected from disclosure. If you are not an intended 
recipient, you are hereby notified that you received this email in error and 
that any review, dissemination, distribution or copying of this email and any 
attachment is strictly prohibited. If you have received this email in error, 
please contact the sender and delete the message and any attachment from your 
system.

ANDRITZ HYDRO GmbH


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806


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

Reply via email to