Adam Wulkiewicz wrote:
Without checking out the code...
You should. It's not much.
IMHO more reasonable approach would be to take more complete implementation and then port some nice solutions from the other one but of course I may be missing something.
Ion's implementation is more complete in that it supports C++03 and optimizes out empty deleters. Mine is "more complete" in that it supports unique_ptr<T[N]> with proper shared_ptr-style conversions and is "better" in that it does all that with a single template, without triplication. I've also decided to make unique_ptr<T>( new U ) and unique_ptr<T>( unique_ptr<U>() ) only compile when U* can be deleted properly via T*, that is, when they share the same cv-less type or when T has a virtual destructor.
I'm guessing that after adding the move emulation for C++98, optimizations, workarounds, etc. the code would look different.
It certainly will look different. I'm still undecided on whether it'd be better to maintain two separate implementations, one C++11 and one C++03, or to #ifdef everything in a single file. Both approaches have their pros and cons. More head-scratching is required.