Custom arguments to std::set comparison function
问题 I know how to pass a regular comparison class or function to set::set<>. I am writing some test code and I want to emulate some C libraries using STL's std::set and I want to be able to pass a C callback to the comparison object so a different comparison takes place. I have the following theoretical code: struct MyClass { int a; }; typedef bool (*user_callback_t)(void *, void *); class MyComparison { private: user_callback_t cb = nullptr; public: MyComparison(user_callback_t cb): cb(cb) { }