I have a std::map, and I would like to add a valid key to iterate over it later, but without giving any value (it will be given later on in the course of the iterations).
I suppose something that could help you out is Boost.Optional.
#include #include class CantConstructMe { CantConstructMe() {} }; int main() { std::map > m; m[0]; }
The lack of available default constructor is not an issue, by default optional will be empty.
optional