Q:

Assigning to a shared_ptr, is there a way to do it?

is there a way of first initialize shared_ptr with nullptr and after some time assing a pointer to a class to it?  
//pseudo code
std::shared_ptr<MyClass> ptr(nullptr);  
//and later
ptr->assign(new MyClass);

A:

Are you looking for ptr.reset( new MyClass )?

A:

Use shared_ptr::reset:
std::shared_ptr<MyClass> ptr;

ptr.reset(new MyClass);

