<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jul 17, 2014 at 4:58 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Thu, Jul 17, 2014 at 4:45 PM, Alp Toker <<a href="mailto:alp@nuanti.com">alp@nuanti.com</a>> wrote:<br>
</div><div class="">
> In many cases there shouldn't be a need for smart pointers at all, because<br>
> the object is owned by a central facility's smart pointer so it's safe to<br>
> just pass around the pointer in ephemeral contexts like stack-based<br>
> instances. In such context raw pointers and references aren't scary --<br>
> they're just fine.<br>
<br>
</div>There's no contention there - if the pointer is non-owning, there's no<br>
smart pointer to use. Indeed using a smart pointer for a non-owning<br>
pointer would actually break the code by causing double deletes, etc.<br>
<br>
Well, shared_ptr notwithstanding - but, yes, choosing between<br>
unique_ptr + non-owning pointers and shared_ptr can sometimes be<br>
non-obvious, but I'm hopeful we generally agree that if there is a<br>
dominating owner they can be given exclusive ownership through a<br>
unique_ptr and everyone else can use raw pointers.</blockquote><div><br></div><div>What about weak_ptr? </div></div></div></div>