On 8/12/2014 11:12 AM, Vladimir Vukicevic wrote:
It's unfortunate that we can't create a nsCOMPtr<> that will disallow assignment to a bare 
pointer without an explicit .get(), but will still allow conversion to a bare pointer for arg passing 
purposes.  (Or can we? I admit my C++-fu is not that strong in this area...)  It would definitely be 
nice to get rid of already_AddRefed<> (not least because the spelling of "Refed" 
always grates when I see it :).

The use of a method like
  operator T*() && = delete;

causes the conversion to fail if the nsCOMPtr is an rvalue (most temporaries). It still allows T *foo = localVariable; (there's no easy way around that).

--
Joshua Cranmer
Thunderbird and DXR developer
Source code archæologist

_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to