#include <queue>#include <map>#include <iostream>#include <string.h> class TestU {public: TestU(char *); ~TestU(); char *getData();private: char *data;}; TestU::TestU(char *d){ if(d) { int len = strlen(d); data = new char[len + 1];…
From: https://www.walletfox.com/course/mapwithcustomclasskey.php If you have ever tried to use a custom class as a key of std::map, most probably you got a compilation error. This article explains why this happens and shows how to make custom classes…