On Friday, January 31, 2003, at 10:59 AM, David B. Held wrote:
"Howard Hinnant" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...[...] I presented code under the thread "SmartPtr (Loki) - auto_ptr/move c'tor issue" on Jan. 28 which does this. For easy reference, here is the code again, slightly improved:http://home.twcny.rr.com/hinnant/Utilities/move_ptr [...]This looks suspiciously like Mojo.
<big laugh> Well, Mojo looks suspiciously like auto_ptr! :-)
I haven't looked at Mojo in a few weeks (http://www.cuj.com/experts/2102/alexandr.htm?topic=experts), which is long enough for my limited mental cache to flush. But when I did look at it, I noted that it looked like a generalized auto_ptr design. Andrei can correct me if I'm wrong.Could you describe the differences? Or would you say that Mojo also achieves the same goals? I would like to support Mojo in SmartPtr, but I think we would all like to help people not abuse it.
Whether we're talking about Mojo, or the move_ptr presented, or auto_ptr, one can play these games with auto_ptr_ref-like objects and converting operators. Like Greg Colvin has said, all you have to do is:
:-)exploiting a loophole on a loophole, which I don't think should be imitated unless really, really necessary.
I would hope that any object built in this pattern would be a statement that: Yes, we do need and want standardized move syntax/semantics. No, we can't get there 100% with C++98, and the contortions necessary to achieve what we can are overly complex and subtle. And really the main point I've been trying to drive home is:
*******************************************************
* *
* Do not move from an lvalue with copy syntax. *
* *
*******************************************************
Doing so will turn compile time errors into run time errors (as shown earlier in this thread).
To implement the sample C++98 move_ptr, I literally started with auto_ptr source and just disabled the "copy" from lvalue by making it private, and then shook what was left around until it passed a few simple unit tests. It is just a proof of concept that you don't have to move with copy syntax in C++98.
-Howard
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost