4 Comments

did you have anything w/ result_of, invoke and invoke_result ? if not it's a suggestion :)

Expand full comment

I didn't do much with the meta-programming part of C++ (it tends to be hard to present in isolation), but this might work 🤔

Expand full comment

It has alway been very counter-intuitive to me that when you write a custom lambda (in this case left.size() > right.size()) for priority_queue, it pops out smaller elements first. I always have to remind myself “It’s the other way around”. I think I even came up with a mental picture to memorize that.

Do you have a better way to remember this? Or a technical detail that I couldn’t find.

Expand full comment

It's not much better, but you can remember that it is a max-heap (same as the heap algorithms).

Expand full comment