Create memory.h

memory.h provides a similar API to the ones provided by smart pointers in the standard libraries