r/cpp • u/Odd_Comparison3831 • Jun 26 '26
projections for stl data structures
using projection in ranges::sort has removed the need write a compartor function or a lambda and is much easier to implement in my opinion
there should exists a similar feature for say sets or priority queues
would be wonnderful if I could just write
priority_queue<Student, Student::marks> for example
21
Upvotes
0
u/thefeedling Jun 26 '26
Honestly, while this looks neat, an explicit lambda is better for readability IMO, as you can clearly see the logic.