Equivalent to Java/C#/Python implementations.
Simple copy of current auto_ptr support (just suppport for functions returning std::unique_ptr). Closes #1722