
Peter Dimov wrote:
why in type? This could be stored in trampoline function, stored together with pointer, something like this http://b.kozicki.pl/cpp/ext_auto_ptr_090.zip
So that sizeof(move_ptr<T>) can be the same as sizeof(T*).
No quite. You can have sizeof(move_ptr<T, &your_deleter_goes_here>) the same size as sizeof(T*), but you need to "encode" deleter into smart pointer type. What about yet another smart opinter class that does *not* store deleter info inside its type? Or about providing specialization of move_ptr, that will have slightly higher overhead and provide runtime selection of deleter, something like: template <typename T> class move_ptr<T, dynamic> { // ... something similar to ext_auto_ptr_090 goes here }; sizeof(move_ptr<T, dynamic>) == sizeof(move_ptr<T, &deleter>) * 4 B.