I'm working in C++ and want to create a function with an optional parameter that is a QMap. The question is what do I set the default value to. I want it to be an empty map.
void function(int i, QMap< QString, QString > MyMap = ???)
what do you put for ???
Question:
what do you put for ???
You can put a default constructed object.
void function(int i, QMap< QString, QString > MyMap = QMap<QString, QString>())
You can put a call to a function that returns a compatible object.
QMap< QString, QString > const& foo();
void function(int i, QMap< QString, QString > MyMap = foo())
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