std::map with std::function as key results in segmentation fault on insertion
I've encountered a strange issue with I'm updating my dependencies and I've been banging my head against this for hours. I'm trying to use `std::map` in C++17, where I want to store objects based on a `std::function` as the key. However, when I attempt to insert a new key-value pair, I encounter a segmentation fault. Here's the minimal code that reproduces the question: ```cpp #include <iostream> #include <map> #include <functional> #include <string> class MyClass { public: MyClass(int value) : value(value) {} void display() const { std::cout << "Value: " << value << '\n'; } private: int value; }; int main() { std::map<std::function<bool(int)>, MyClass> myMap; auto func = [](int x) { return x > 0; }; MyClass obj(10); myMap.insert({func, obj}); // Segmentation fault occurs here return 0; } ``` I've also tried using `std::bind` instead of a lambda function, but the scenario continues. The compiler does not complain during compilation, and it passes without warnings, but when I run the program, it crashes with a segmentation fault. I've checked that `MyClass` objects are being constructed correctly, so I'm at a loss as to why this is happening. Is there a limitation using `std::function` as a key in `std::map`? Or is there a best practice I should be following to achieve a similar outcome? Would switching to a different type of key solve this scenario? Any guidance would be appreciated! For context: I'm using Cpp on Ubuntu. Has anyone else encountered this? Any examples would be super helpful. This is my first time working with Cpp 3.10. Could this be a known issue? I'm working in a Debian environment.