I ran into this code and don't know what it does. Can you decipher it?
typedef std::map<std::string, bool (Foo::*)()> x_t;
The part I don't understand is the value of the map. I'm surprised its valid c++ syntax.
Thanks.
bool (Foo::*)() is a pointer to member function of Foo that takes no arguments and returns bool. So x_t is probably used to map names of member functions to the actual members.
x_t is a map from a string to a pointer-to-member-function-of-Foo returning bool.
You can read C++ declarations backwards, or in some cases, inside out. The value of the map is read from the * as a Foo member function returning bool, the key of the map is clearly a string, and x_t is a type alias for a map from key to value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With