<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>weak_ptr Archives - Fluent C++</title>
	<atom:link href="https://www.fluentcpp.com/tag/weak_ptr/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.fluentcpp.com/tag/weak_ptr/</link>
	<description>Jonathan Boccara&#039;s blog</description>
	<lastBuildDate>Tue, 27 Aug 2019 03:16:12 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
<site xmlns="com-wordpress:feed-additions:1">214950964</site>	<item>
		<title>unique_ptr, shared_ptr, weak_ptr, scoped_ptr, raw pointers &#8211; Knowing your smart pointers (2/7)</title>
		<link>https://www.fluentcpp.com/2017/08/25/knowing-your-smart-pointers/</link>
					<comments>https://www.fluentcpp.com/2017/08/25/knowing-your-smart-pointers/#comments</comments>
		
		<dc:creator><![CDATA[Jonathan Boccara]]></dc:creator>
		<pubDate>Fri, 25 Aug 2017 01:00:43 +0000</pubDate>
				<category><![CDATA[Smart pointers]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[move]]></category>
		<category><![CDATA[raw pointer]]></category>
		<category><![CDATA[scoped_ptr]]></category>
		<category><![CDATA[shared_ptr]]></category>
		<category><![CDATA[smart pointer]]></category>
		<category><![CDATA[unique_ptr]]></category>
		<category><![CDATA[weak_ptr]]></category>
		<guid isPermaLink="false">https://www.fluentcpp.com/?p=1056</guid>

					<description><![CDATA[<p>This is episode 2 in y  series Smart Developers Use Smart Pointers. The series contains: Smart pointer basics unique_ptr, shared_ptr, weak_ptr, scoped_ptr, raw pointers: clearly stating your intentions by knowing your smart pointers Custom deleters and How to make them more expressive Changing deleters during the life of a unique_ptr How to implement the pimpl idiom [&#8230;]</p>
<p>The post <a href="https://www.fluentcpp.com/2017/08/25/knowing-your-smart-pointers/">unique_ptr, shared_ptr, weak_ptr, scoped_ptr, raw pointers &#8211; Knowing your smart pointers (2/7)</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><a href="https://www.fluentcpp.com/dailycpp"><img data-recalc-dims="1" decoding="async" class="aligncenter wp-image-1947 size-full" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/09/daily-able-content-e1505330890615.png?resize=120%2C116&#038;ssl=1" alt="Daily C++" width="120" height="116" /></a></p>
<p>This is episode 2 in y  series Smart Developers Use Smart Pointers. The series contains:</p>
<ul>
<li><a href="https://www.fluentcpp.com/2017/08/22/smart-developers-use-smart-pointers-smart-pointers-basics/">Smart pointer basics</a></li>
<li>unique_ptr, shared_ptr, weak_ptr, scoped_ptr, raw pointers: clearly stating your intentions by knowing your smart pointers</li>
<li><a href="https://www.fluentcpp.com/2017/08/29/custom-deleters/">Custom deleters</a> and <a href="https://www.fluentcpp.com/2017/09/01/make-custom-deleters-expressive/">How to make them more expressive</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/05/changing-deleters-during-the-life-of-a-unique_ptr/">Changing deleters during the life of a unique_ptr</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/22/make-pimpl-using-unique_ptr/">How to implement the pimpl idiom by using unique_ptr</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/">How to make a polymorphic clone in modern C++</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/">How to Return a Smart Pointer AND Use Covariance</a> (by Raoul Borges)</li>
</ul>
<p>Like we saw when discussing what smart pointers are about, some active decision has to be taken about how a smart pointer should be copied. Otherwise, a default copy constructor would likely lead to undefined behaviour.</p>
<p>It turns out that there are several valid ways to go about this, and this leads to a variety of smart pointers. And it is important to understand what these various smart pointers do because they are ways to <strong>express a design</strong> into your code, and therefore also to <strong>understand a design</strong> by reading code.</p>
<p>We see here the various types of pointers that exist out there, approximately sorted by decreasing order of usefulness (according to me):</p>
<ul>
<li>std::unique_ptr</li>
<li>raw pointer</li>
<li>std::shared_ptr</li>
<li>std::weak_ptr</li>
<li>boost::scoped_ptr</li>
<li>std::auto_ptr</li>
</ul>
<h3><span style="color: #ff6600;"><code>std::unique_ptr</code></span></h3>
<p>As of this writing, this is the smart pointer to use by default. It came into the standard in C++11.</p>
<p>The semantics of <code>std::unique_ptr</code> is that it is the sole owner of a memory resource. A <code>std::unique_ptr</code> will hold a pointer and delete it in its destructor (unless you customize this, which is the topic of another post).</p>
<p>This allows you to express your intentions in an interface. Consider the following function:</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;House&gt; buildAHouse();</pre>
<p>It tells you that it gives you a pointer to a house, of which you are the owner. <strong>No one else will delete this pointer</strong> except the <code>unique_ptr</code> that is returned by the function. And since you get the ownership, this gives you confidence that you are free to modify the value of the pointed to object. Note that <code>std::unique_ptr</code> is the preferred pointer to return from a <strong>factory</strong> function. Indeed, on the top of taking care of handling the memory, <code>std::unique_ptr</code> wraps a normal pointer and is therefore compatible with polymorphism.</p>
<p>But this works the other way around too, by passing an <code>std::unique_ptr</code> as a parameter:</p>
<pre class="lang:c++ decode:true ">class House
{
public:
    House(std::unique_ptr&lt;PileOfWood&gt; wood);
    ...</pre>
<p>In this case, the house takes ownership of the <code>PileOfWood</code>.</p>
<p>Note though that even when you receive a unique_ptr, you&#8217;re not guaranteed that no one else has access to this pointer. Indeed, if another context keeps a copy of the pointer inside your unique_ptr, then modifying the pointed to object through the unique_ptr object will of course impact this other context. But since you are the owner, you are allowed to safely modify the pointed to object, and the rest of the design should take this into account. If you don&#8217;t want this to happen, the way to express it is by using a <strong>unique_ptr to const</strong>:</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;const House&gt; buildAHouse(); // for some reason, I don't want you
                                            // to modify the house you're being passed</pre>
<p>To ensure that there is only one unique_ptr that owns a memory resource, <code>std::unique_ptr</code> cannot be copied. The ownership can however be <strong>transferred</strong> from one unique_ptr to another (which is how you can pass them or return them from a function) by <strong>moving</strong> a unique_ptr into another one.</p>
<p>A move can be achieved by returning an <code>std::unique_ptr</code> by value from a function, or explicitly in code:</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;int&gt; p1 = std::make_unique(42);
std::unique_ptr&lt;int&gt; p2 = move(p1); // now p2 hold the resource
                                       and p1 no longer hold anything</pre>
<h3><span style="color: #ff6600;">Raw pointers</span></h3>
<p>&#8220;What?&#8221;, you may be thinking. &#8220;We&#8217;re talking about smart pointers, what are raw pointers doing here??&#8221;</p>
<p>Well, even if raw pointers are not smart pointers, they aren&#8217;t &#8216;dumb&#8217; pointers either. In fact there are legitimate reasons to use them although these reasons don&#8217;t happen often. They share a lot with references, but the latter should be preferred except in some cases (but this is the topic of another post).</p>
<p>For now I only want to focus on what raw pointers and references express in code: <strong>raw pointers and references represent access to an object, but not ownership</strong>. In fact, this is the default way of passing objects to functions and methods:</p>
<pre class="lang:c++ decode:true">void renderHouse(House const&amp; house);</pre>
<p>This is particularly relevant to note when you hold an object with a unique_ptr and want to pass it to an interface. You don’t pass the unique_ptr, nor a reference to it, but rather a reference to the pointed to object:</p>
<pre class="lang:c++ decode:true">std::unique_ptr&lt;House&gt; house = buildAHouse();
renderHouse(*house);</pre>
<h3><span style="color: #ff6600;"><code>std::shared_ptr</code></span></h3>
<p><code>shared_ptr</code> entered the standard in C++11, but appeared in boost well before that.</p>
<p><strong>A single memory resource can be held by several <code>std::shared_ptr</code>s at the same time</strong>. The shared_ptrs internally maintain a count of how many of them there are holding the same resource, and when the last one is destroyed, it deletes the memory resource.</p>
<p>Therefore <code>std::shared_ptr</code> allows copies, but with a reference-counting mechanism to make sure that every resource is deleted once and only once.</p>
<p>At first glance, <code>std::shared_ptr</code> looks like the panacea for memory management, as it can be passed around and still maintain memory safety.</p>
<p>But <strong><code>std::shared_ptr</code> should not be used by default</strong>, for several reasons:</p>
<ul>
<li>Having several simultaneous holders of a resource makes for a <strong>more complex</strong> system than with one unique holder, like with <code>std::unique_ptr</code>. Even though an <code>std::unique_ptr</code> doesn&#8217;t prevent from accessing and modifying its resource, it sends a message that it is the priviledged owner of a resource. For this reason you&#8217;d expect it to centralize the control of the resource, at least to some degree.</li>
<li>Having several simultaneous holders of a resource makes <strong>thread-safety</strong> harder,</li>
<li>It makes the <strong>code counter-intuitive</strong> when an object is not shared in terms of the domain and still appears as &#8220;shared&#8221; in the code for a technical reason,</li>
<li>It can incur a <strong>performance</strong> cost, both in time and memory, because of the bookkeeping related to the reference-counting.</li>
</ul>
<p><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="alignright size-medium wp-image-1061" src="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=260%2C300&#038;ssl=1" alt="" width="260" height="300" srcset="https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=260%2C300&amp;ssl=1 260w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=130%2C150&amp;ssl=1 130w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=28%2C32&amp;ssl=1 28w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=87%2C100&amp;ssl=1 87w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=174%2C201&amp;ssl=1 174w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=347%2C400&amp;ssl=1 347w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=382%2C440&amp;ssl=1 382w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?resize=468%2C540&amp;ssl=1 468w, https://i0.wp.com/www.fluentcpp.com/wp-content/uploads/2017/04/shared_ptr_graph2.png?w=583&amp;ssl=1 583w" sizes="(max-width: 260px) 100vw, 260px" />One good case for using <code>std::shared_ptr</code> though is when objects are <strong>shared in the domain.</strong> Using shared pointers then reflects it in an expressive way. Typically, the nodes of a graphs are well represented as shared pointers, because several nodes can hold a reference to one other node.</p>
<h3><span style="color: #ff6600;"><code>std::weak_ptr</code></span></h3>
<p><code>weak_ptr</code> entered the language in C++11 but appeared in boost well before that.</p>
<p><code>std::weak_ptr</code>s can hold a reference to a shared object along with other <code>std::shared_ptr</code>s, but they don&#8217;t increment the reference count. This means that if no more <code>std::shared_ptr</code> are holding an object, this object will be deleted even if some weak pointers still point to it.</p>
<p>For this reason, a weak pointer needs to check if the object it points to is still alive. To do this, it has to be copied into to a <code>std::shared_ptr</code>:</p>
<pre class="lang:c++ decode:true">void useMyWeakPointer(std::weak_ptr&lt;int&gt; wp)
{
    if (std::shared_ptr&lt;int&gt; sp = wp.lock())
    {
        // the resource is still here and can be used
    }
    else
    {
        // the resource is no longer here
    }
}</pre>
<p>A typical use case for this is about <strong>breaking shared_ptr circular references</strong>. Consider the following code:</p>
<pre class="lang:c++ decode:true">struct House
{
    std::shared_ptr&lt;House&gt; neighbour;
};

std::shared_ptr&lt;House&gt; house1 = std::make_shared&lt;House&gt;();
std::shared_ptr&lt;House&gt; house2 = std::make_shared&lt;House&gt;();;
house1-&gt;neighbour = house2;
house2-&gt;neighbour = house1;
</pre>
<p>None of the houses ends up being destroyed at the end of this code, because the shared_ptrs points into one another. But if one is a weak_ptr instead, there is no longer a circular reference.</p>
<p>Another use case pointed out by <a href="http://stackoverflow.com/a/106614/6182257" target="_blank" rel="noopener noreferrer">this answer on Stack Overflow</a> is that weak_ptr can be used to <strong>maintain a cache</strong>. The data may or may not have been cleared from the cache, and the weak_ptr references this data.</p>
<h3><span style="color: #ff6600;"><code>boost::scoped_ptr</code></span></h3>
<p><code>scoped_ptr</code> is present in boost but was not included in the standard.</p>
<p>It simply disables the copy and even the move construction. So it is the sole owner of a resource, and its ownership cannot be transferred. Therefore, a scoped_ptr can only live inside&#8230; a scope. Or as a data member of an object.  And of course, as a smart pointer, it keeps the advantage of deleting its underlying pointer in its destructor.</p>
<h3><span style="color: #ff6600;"><code>std::auto_ptr</code></span></h3>
<p><code>auto_ptr</code> was present in C++98, has been deprecated in C++11 and removed from the language in C++17.</p>
<p>It aimed at filling the same need as <code>unique_ptr</code>, but back when move semantics didn&#8217;t exist in C++. It essentially does in its <strong>copy constructor</strong> what unique_ptr does in its <strong>move constructor</strong>. But auto_ptr is inferior to unique_ptr and you shouldn&#8217;t use it if you have access to unique_ptr, because it can lead to erroneous code:</p>
<pre class="lang:c++ decode:true ">std::auto_ptr&lt;int&gt; p1(new int(42));
std::auto_ptr&lt;int&gt; p2 = p1; // it looks like p2 == p1, but no!
                               p1 is now empty and p2 uses the resource</pre>
<p>You know Andersen’s The Ugly Duckling, where a poor little ducking is rejected by its siblings because it’s not good-looking, and who turns out to grow into a beautiful swan? The story of std::auto_ptr is like this but going back in time: std::auto_ptr started by being the way to go to deal with ownership, and now it looks terrible in front of its siblings. It’s like The Ugly Benjamin Button Duckling, if you will.</p>
<p><img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>Stay tuned as in the next episode of this series we will see how to simplify complex memory management by using the more advanced features of <code>std::unique_ptr</code>.</p>
<p>Related articles:</p>
<ul>
<li><a href="https://www.fluentcpp.com/2017/08/22/smart-developers-use-smart-pointers-smart-pointers-basics/">Smart pointer basics</a></li>
<li><a href="https://www.fluentcpp.com/2017/08/29/custom-deleters/">Custom deleters</a> and <a href="https://www.fluentcpp.com/2017/09/01/make-custom-deleters-expressive/">How to make them more expressive</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/05/changing-deleters-during-the-life-of-a-unique_ptr/">Changing deleters during the life of a unique_ptr</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/22/make-pimpl-using-unique_ptr/">How to implement the pimpl idiom by using unique_ptr</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/08/make-polymorphic-copy-modern-cpp/">How to make a polymorphic clone in modern C++</a></li>
<li><a href="https://www.fluentcpp.com/2017/09/12/how-to-return-a-smart-pointer-and-use-covariance/">How to Return a Smart Pointer AND Use Covariance</a> (by Raoul Borges)</li>
</ul>
Don't want to miss out ? <strong>Follow:</strong> &nbsp&nbsp<a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Follow me on twitter" href="https://twitter.com/joboccara" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img data-recalc-dims="1" decoding="async" alt="twitter" title="Follow me on twitter" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Find us on Linkedin" href="https://www.linkedin.com/in/jonathan-boccara-23826921/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img data-recalc-dims="1" loading="lazy" decoding="async" alt="linkedin" title="Find us on Linkedin" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" /></a><a class="synved-social-button synved-social-button-follow synved-social-size-48 synved-social-resolution-single synved-social-provider-rss nolightbox" data-provider="rss" target="_blank" rel="nofollow" title="Subscribe to our RSS Feed" href="https://www.fluentcpp.com/feed/" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img data-recalc-dims="1" loading="lazy" decoding="async" alt="rss" title="Subscribe to our RSS Feed" class="synved-share-image synved-social-image synved-social-image-follow" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/rss.png?resize=48%2C48&#038;ssl=1" /></a><br/>Share this post!<a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-facebook nolightbox" data-provider="facebook" target="_blank" rel="nofollow" title="Check out this post from Fluent C++" href="https://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.fluentcpp.com%2F2017%2F08%2F25%2Fknowing-your-smart-pointers%2F&#038;t=unique_ptr%2C%20shared_ptr%2C%20weak_ptr%2C%20scoped_ptr%2C%20raw%20pointers%20%E2%80%93%20Knowing%20your%20smart%20pointers%20%282%2F7%29&#038;s=100&#038;p&#091;url&#093;=https%3A%2F%2Fwww.fluentcpp.com%2F2017%2F08%2F25%2Fknowing-your-smart-pointers%2F&#038;p&#091;images&#093;&#091;0&#093;=https%3A%2F%2Fwww.fluentcpp.com%2Fwp-content%2Fuploads%2F2017%2F09%2Fdaily-able-content-e1505330890615.png&#038;p&#091;title&#093;=unique_ptr%2C%20shared_ptr%2C%20weak_ptr%2C%20scoped_ptr%2C%20raw%20pointers%20%E2%80%93%20Knowing%20your%20smart%20pointers%20%282%2F7%29" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img data-recalc-dims="1" loading="lazy" decoding="async" alt="Facebook" title="Check out this post from Fluent C++" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/facebook.png?resize=48%2C48&#038;ssl=1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox" data-provider="twitter" target="_blank" rel="nofollow" title="Tweet about this" href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fwww.fluentcpp.com%2F2017%2F08%2F25%2Fknowing-your-smart-pointers%2F&#038;text=Check%20out%20this%20post%20from%20Fluent%20C%2B%2B" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px"><img data-recalc-dims="1" loading="lazy" decoding="async" alt="twitter" title="Tweet about this" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/twitter.png?resize=48%2C48&#038;ssl=1" /></a><a class="synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox" data-provider="linkedin" target="_blank" rel="nofollow" title="Share on Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&#038;url=https%3A%2F%2Fwww.fluentcpp.com%2F2017%2F08%2F25%2Fknowing-your-smart-pointers%2F&#038;title=unique_ptr%2C%20shared_ptr%2C%20weak_ptr%2C%20scoped_ptr%2C%20raw%20pointers%20%E2%80%93%20Knowing%20your%20smart%20pointers%20%282%2F7%29" style="font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px"><img data-recalc-dims="1" loading="lazy" decoding="async" alt="linkedin" title="Share on Linkedin" class="synved-share-image synved-social-image synved-social-image-share" width="48" height="48" style="display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none" src="https://i0.wp.com/www.fluentcpp.com/wp-content/plugins/social-media-feather/synved-social/image/social/regular/96x96/linkedin.png?resize=48%2C48&#038;ssl=1" /></a><p>The post <a href="https://www.fluentcpp.com/2017/08/25/knowing-your-smart-pointers/">unique_ptr, shared_ptr, weak_ptr, scoped_ptr, raw pointers &#8211; Knowing your smart pointers (2/7)</a> appeared first on <a href="https://www.fluentcpp.com">Fluent C++</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.fluentcpp.com/2017/08/25/knowing-your-smart-pointers/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1056</post-id>	</item>
	</channel>
</rss>
