[Development] QtCS - QObject discussion
Andre Somers
andre at familiesomers.nl
Mon Jul 29 21:26:59 CEST 2013
Op 29-7-2013 17:24, Thiago Macieira schreef:
> On segunda-feira, 29 de julho de 2013 14:00:05, André Somers wrote:
>>> http://herbsutter.com/2012/06/21/reader-qa-why-dont-modern-smart-pointers-> > implicitly-convert-to/
>> That would solve it, but I am not convinced either way. I am also not
>> convinced that not having to use .data() is worth the risk introducing
>> operator T*. At the very least the delete should then be disabled as well.
> There's no way to disable delete, aside from removing operator T*.
There are some tricks against that. Andrei Alexandrescu describes one,
if I'm not mistaken. I don't have the book next to me at this moment
though. I think this stackoverflow post is inspired on that work:
http://stackoverflow.com/questions/3312031/c-smart-pointer-template-that-auto-converts-to-bare-pointer-but-cant-be-exp/3312507#3312507
André
More information about the Development
mailing list