So long as the object in question isn't removed from the map, then yes it is safe. Once inserted into a map objects don't move around even if other elements are added or removed.
object& obj = objmap.find(num)->second;
This is potentially dangerous unless you are sure that an element with key num actually exists in the map. If you are not sure, you could use the overload of insert that returns an iterator and a bool which indicates whether a new element was inserted or an element with the given key was already present in the map.
E.g.
object& obj = objmap.insert( std::make_pair(num, object(arg1, arg2, argN)) ).first->second;
This is safe as long as the element isn't removed from the map.
However, the second line is not quite safe :
object& obj = objmap.find(num)->second;
If there is no elements with key num in the map, find will return objmap.end(). This possibility should be tested before dereferencing the returned iterator :
const std::map<int, object>::iterator it = objmap.find(num);
if (it != objmap.end())
{
object& obj = it->second;
/* ... */
}
Now, if the goal isn't really to find but really to insert, calling operator[] is a possibility (although, as you already noticed, it requires the value to provide a parameterless constructor). But you have to understand that these are two very different things :
findonly finds : if the key isn't found, nothing gets inserted and theenditerator is returnedoperator[]always returns a reference to a value in the map : were the key absent, an insertion occurs (for a default constructed value : thus the constructor requirement)