Simple factory retrieving object by name
In general your code looks fine, though there are some points to improve:

Memory management

Instead of using raw pointers and new delete, you should use a smart pointer to express transfer of ownership explicitly:

template&lt;typename O&gt;
void register_type(const std::string &amp; name) {
    types[name] = [](){ return std::unique_ptr&lt;O&gt;(new O); };
}

std::unique_ptr&lt;object&gt; get_object(const std::string &amp; object_name ) {
    return types[object_name]();
}


Thus it's clear, the caller will own the object instance, and doesn't need to struggle calling delete correctly if the obtained instance goes out of scope.

Template parameter naming

The more usual name for the template parameter is rather T than O

Use a factory class instead of global functions and global map

Consolidate the code of the register_type(), get_object() functions and the types map variable into a class Registry, and provide a single instance of that one.

This would allow to encapsulate the types map as a private class member.

You could consider making that class a Singleton.

Check if the type name is registered

You should check if the string passed to the get_object() function was already registered in the map, rather than blindly calling the default (NOP) function from the map.

Usage of static for a global function

You should be aware that static actually make the register_type() function only visible for the translation unit, it appears in. Actually you should not need it.



BTW, the technique you're using is often seen for unit testing frameworks (like e.g. google-test) as test case factories, also often coming along with stringizing macros for the registered classes.