I asked an earlier question, which got off-topic in CString and Unicode issues. I\'ve now reduced my example to namespace std and cout (instead
namespace std
cout
At Slava's insistence, I worked with ctors to find an easy fix:
#include #include #include struct Params { int inputType; std::string moduleName; Params(const int n, const std::string& s) : inputType(n), moduleName(s) { } }; int main() { std::map options = { { "Add", Params(30, "RecordLib" ) }, { "Open", Params(40, "ViewLib" ) }, { "Close", Params(50, "EditLib" ) }, { "Inventory", Params(60, "ControlLib") }, { "Report", Params(70, "ReportLib" ) } }; for (const auto& pair : options) { std::cout << "Entry: " << pair.first << " ==> { " << pair.second.moduleName << " }" << std::endl; } return 0; }
However, the original code should have worked, and apparently is an acknowledged bug by Microsoft.