Pass all Ptr (shared_ptr) arguments as const references.

- Big improvement in performance.
Pass boost::any arguments as const references.