I tried this:
std::map<int,int> m;
and it works -- m
becomes an empty map. But this approach may not work if the compiler choose to not initialize m
to an empty map by default. Better solution?
I tried this:
std::map<int,int> m;
and it works -- m
becomes an empty map. But this approach may not work if the compiler choose to not initialize m
to an empty map by default. Better solution?
Any better solution?
Taking your question literally, no. There is no better solution.
This will create a default constructed, and therefore empty std::map<int,int>
.
std::map<int,int> m;