Mike, I really appreciate seeing the non-trivial uses. Few online examples cover anything more than just a rehash of what the basic definition states. And it is always good to see the places where your code doesn't compile on the first pass: really helpful to those of us learning the quirks of the language😅. While it may add a few seconds to the video, it adds miles to troubleshooting.
Thank you for the kind words! Agreed, I like to leave the mistakes in -- showing how to get out of trouble is valuable and also humanizing 🙂 At the least, a different style than what is out there for folks who prefer my style 😛
@@MikeShah One thing I would like an explanation on, or a video on similar topics, would be why exactly having a Functor can be used as a comparison object to be inserted into a map's template argument. I understand it can be used because a map needs a comparison operation but I'm interested, and fairly uncertain, as to how the syntax and semantics or C++ allows it.
Thanks Mike for these great STL series. I am learning a lot. I just have a question: if i have a vector of size n and want to create a std::map from this vector , would that be o(log(n))*n?!
Yup, that's essentially it 🙂we might think of 'set' more naturally with union/intersection operations mathematically, but from a programming perspective, set lacks a value :) both usually rb-tree, ordered, and store unique values.
Hello Mike! Nice vibe on your videos, thank you! Btw, I tried understanding why the member operator< didn't work for you, but couldn't come up with any explanation. I had no problems with both a member operator< and a friend one 🤔.