<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qshareddata.cpp --> <title>QExplicitlySharedDataPointer Class | Qt Core 5.12.6</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtcore-index.html">Qt Core</a></td><td ><a href="qtcore-module.html">C++ Classes</a></td><td >QExplicitlySharedDataPointer</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtcore-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#protected-functions">Protected Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QExplicitlySharedDataPointer Class</h1> <!-- $$$QExplicitlySharedDataPointer-brief --> <p>The <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> class represents a pointer to an explicitly shared object. <a href="#details">More...</a></p> <!-- @@@QExplicitlySharedDataPointer --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QExplicitlySharedDataPointer></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += core</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.4</td></tr></table></div><ul> <li><a href="qexplicitlyshareddatapointer-members.html">List of all members, including inherited members</a></li> </ul> <p><b>Note:</b> All functions in this class are reentrant.</p> <a name="public-types"></a> <h2 id="public-types">Public Types</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> typedef </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#Type-typedef">Type</a></b></td></tr> </table></div> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer-1">QExplicitlySharedDataPointer</a></b>(T *<i>data</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer-2">QExplicitlySharedDataPointer</a></b>(const QExplicitlySharedDataPointer<T> &<i>o</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer-3">QExplicitlySharedDataPointer</a></b>(const QExplicitlySharedDataPointer<X> &<i>o</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer-4">QExplicitlySharedDataPointer</a></b>(QExplicitlySharedDataPointer<T> &&<i>o</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#dtor.QExplicitlySharedDataPointer">~QExplicitlySharedDataPointer</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#constData">constData</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#data">data</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#detach">detach</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#reset">reset</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#swap">swap</a></b>(QExplicitlySharedDataPointer<T> &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#take">take</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-bool">operator bool</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-not">operator!</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-not-eq">operator!=</a></b>(const QExplicitlySharedDataPointer<T> &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-not-eq-1">operator!=</a></b>(const T *<i>ptr</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T &</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-2a">operator*</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator--gt">operator-></a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator--gt-1">operator-></a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QExplicitlySharedDataPointer<T> &</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-eq">operator=</a></b>(const QExplicitlySharedDataPointer<T> &<i>o</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QExplicitlySharedDataPointer<T> &</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-eq-1">operator=</a></b>(T *<i>o</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QExplicitlySharedDataPointer<T> &</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-eq-2">operator=</a></b>(QExplicitlySharedDataPointer<T> &&<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-eq-eq">operator==</a></b>(const QExplicitlySharedDataPointer<T> &<i>other</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#operator-eq-eq-1">operator==</a></b>(const T *<i>ptr</i>) const</td></tr> </table></div> <a name="protected-functions"></a> <h2 id="protected-functions">Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> T *</td><td class="memItemRight bottomAlign"><b><a href="qexplicitlyshareddatapointer.html#clone">clone</a></b>()</td></tr> </table></div> <a name="details"></a> <!-- $$$QExplicitlySharedDataPointer-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> class represents a pointer to an explicitly shared object.</p> <p><a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a><T> makes writing your own explicitly shared classes easy. <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> implements thread-safe reference counting, ensuring that adding QExplicitlySharedDataPointers to your reentrant classes won't make them non-reentrant.</p> <p>Except for one big difference, <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> is just like <a href="qshareddatapointer.html">QSharedDataPointer</a>. The big difference is that member functions of <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> <i>do not</i> do the automatic <i>copy on write</i> operation (<a href="qexplicitlyshareddatapointer.html#detach">detach</a>()) that non-const members of <a href="qshareddatapointer.html">QSharedDataPointer</a> do before allowing the shared data object to be modified. There is a <a href="qexplicitlyshareddatapointer.html#detach">detach</a>() function available, but if you really want to <a href="qexplicitlyshareddatapointer.html#detach">detach</a>(), you have to call it yourself. This means that QExplicitlySharedDataPointers behave like regular C++ pointers, except that by doing reference counting and not deleting the shared data object until the reference count is 0, they avoid the dangling pointer problem.</p> <p>It is instructive to compare <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> with <a href="qshareddatapointer.html">QSharedDataPointer</a> by way of an example. Consider the <a href="qshareddatapointer.html#employee-example">Employee example</a> in <a href="qshareddatapointer.html">QSharedDataPointer</a>, modified to use explicit sharing as explained in the discussion <a href="qshareddatapointer.html#implicit-vs-explicit-sharing">Implicit vs Explicit Sharing</a>.</p> <p>Note that if you use this class but find you are calling <a href="qexplicitlyshareddatapointer.html#detach">detach</a>() a lot, you probably should be using <a href="qshareddatapointer.html">QSharedDataPointer</a> instead.</p> <p>In the member function documentation, <i>d pointer</i> always refers to the internal pointer to the shared data object.</p> </div> <p><b>See also </b><a href="qshareddata.html">QSharedData</a> and <a href="qshareddatapointer.html">QSharedDataPointer</a>.</p> <!-- @@@QExplicitlySharedDataPointer --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$Type --> <h3 class="fn" id="Type-typedef"><a name="Type-typedef"></a>typedef QExplicitlySharedDataPointer::<span class="name">Type</span></h3> <p>This is the type of the shared data object. The <i>d pointer</i> points to an object of this type.</p> <!-- @@@Type --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QExplicitlySharedDataPointer[overload1]$$$QExplicitlySharedDataPointer --> <h3 class="fn" id="QExplicitlySharedDataPointer"><a name="QExplicitlySharedDataPointer"></a>QExplicitlySharedDataPointer::<span class="name">QExplicitlySharedDataPointer</span>()</h3> <p>Constructs a <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> initialized with a null <i>d pointer</i>.</p> <!-- @@@QExplicitlySharedDataPointer --> <!-- $$$QExplicitlySharedDataPointer$$$QExplicitlySharedDataPointerT* --> <h3 class="fn" id="QExplicitlySharedDataPointer-1"><a name="QExplicitlySharedDataPointer-1"></a>QExplicitlySharedDataPointer::<span class="name">QExplicitlySharedDataPointer</span>(<span class="type">T</span> *<i>data</i>)</h3> <p>Constructs a <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> with <i>d pointer</i> set to <i>data</i> and increments <i>data</i>'s reference count.</p> <!-- @@@QExplicitlySharedDataPointer --> <!-- $$$QExplicitlySharedDataPointer$$$QExplicitlySharedDataPointerconstQExplicitlySharedDataPointer<T>& --> <h3 class="fn" id="QExplicitlySharedDataPointer-2"><a name="QExplicitlySharedDataPointer-2"></a>QExplicitlySharedDataPointer::<span class="name">QExplicitlySharedDataPointer</span>(const <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &<i>o</i>)</h3> <p>This standard copy constructor sets the <i>d pointer</i> of <i>this</i> to the <i>d pointer</i> in <i>o</i> and increments the reference count of the shared data object.</p> <!-- @@@QExplicitlySharedDataPointer --> <!-- $$$QExplicitlySharedDataPointer$$$QExplicitlySharedDataPointerconstQExplicitlySharedDataPointer<X>& --> <h3 class="fn" id="QExplicitlySharedDataPointer-3"><a name="QExplicitlySharedDataPointer-3"></a>QExplicitlySharedDataPointer::<span class="name">QExplicitlySharedDataPointer</span>(const <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">X</span>> &<i>o</i>)</h3> <p>This copy constructor is different in that it allows <i>o</i> to be a different type of explicitly shared data pointer but one that has a compatible shared data object.</p> <p>By default, the <i>d pointer</i> of <i>o</i> (of type <code>X *</code>) gets implicitly converted to the type <code>T *</code>; the result of this conversion is set as the <i>d pointer</i> of <i>this</i>, and the reference count of the shared data object is incremented.</p> <p>However, if the macro <code>QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST</code> is defined before including the <code>QExplicitlySharedDataPointer</code> header, then the <i>d pointer</i> of <i>o</i> undergoes a <code>static_cast</code> to the type <code>T *</code>. The result of the cast is then set as the <i>d pointer</i> of <i>this</i>, and the reference count of the shared data object is incremented.</p> <p><b>Warning:</b> relying on such <code>static_cast</code> is potentially dangerous, because it allows code like this to compile:</p> <pre class="cpp"> <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><span class="operator"><</span>Base<span class="operator">></span> base(<span class="keyword">new</span> Base); <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><span class="operator"><</span>Derived<span class="operator">></span> derived(base); <span class="comment">// !!! DANGER !!!</span> </pre> <p>Starting from Qt 5.4 the cast is disabled by default. It is possible to enable it back by defining the <code>QT_ENABLE_QEXPLICITLYSHAREDDATAPOINTER_STATICCAST</code> macro, and therefore to allow old code (that relied on this feature) to compile without modifications.</p> <!-- @@@QExplicitlySharedDataPointer --> <!-- $$$QExplicitlySharedDataPointer$$$QExplicitlySharedDataPointerQExplicitlySharedDataPointer<T>&& --> <h3 class="fn" id="QExplicitlySharedDataPointer-4"><a name="QExplicitlySharedDataPointer-4"></a>QExplicitlySharedDataPointer::<span class="name">QExplicitlySharedDataPointer</span>(<span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &&<i>o</i>)</h3> <p>Move-constructs a <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> instance, making it point at the same object that <i>o</i> was pointing to.</p> <p>This function was introduced in Qt 5.2.</p> <!-- @@@QExplicitlySharedDataPointer --> <!-- $$$~QExplicitlySharedDataPointer[overload1]$$$~QExplicitlySharedDataPointer --> <h3 class="fn" id="dtor.QExplicitlySharedDataPointer"><a name="dtor.QExplicitlySharedDataPointer"></a>QExplicitlySharedDataPointer::<span class="name">~QExplicitlySharedDataPointer</span>()</h3> <p>Decrements the reference count of the shared data object. If the reference count becomes 0, the shared data object is deleted. <i>This</i> is then destroyed.</p> <!-- @@@~QExplicitlySharedDataPointer --> <!-- $$$clone[overload1]$$$clone --> <h3 class="fn" id="clone"><a name="clone"></a><code>[protected] </code><span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">clone</span>()</h3> <p>Creates and returns a deep copy of the current data. This function is called by <a href="qexplicitlyshareddatapointer.html#detach">detach</a>() when the reference count is greater than 1 in order to create the new copy. This function uses the <i>operator new</i> and calls the copy constructor of the type T.</p> <p>See <a href="qshareddatapointer.html">QSharedDataPointer</a><T>::clone() for an explanation of how to use it.</p> <p>This function was introduced in Qt 4.5.</p> <!-- @@@clone --> <!-- $$$constData[overload1]$$$constData --> <h3 class="fn" id="constData"><a name="constData"></a>const <span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">constData</span>() const</h3> <p>Returns a const pointer to the shared data object.</p> <p><b>See also </b><a href="qexplicitlyshareddatapointer.html#data">data</a>().</p> <!-- @@@constData --> <!-- $$$data[overload1]$$$data --> <h3 class="fn" id="data"><a name="data"></a><span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">data</span>() const</h3> <p>Returns a pointer to the shared data object.</p> <!-- @@@data --> <!-- $$$detach[overload1]$$$detach --> <h3 class="fn" id="detach"><a name="detach"></a><span class="type">void</span> QExplicitlySharedDataPointer::<span class="name">detach</span>()</h3> <p>If the shared data object's reference count is greater than 1, this function creates a deep copy of the shared data object and sets the <i>d pointer</i> of <i>this</i> to the copy.</p> <p>Because <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> does not do the automatic <i>copy on write</i> operations that members of <a href="qshareddatapointer.html">QSharedDataPointer</a> do, detach() is <i>not</i> called automatically anywhere in the member functions of this class. If you find that you are calling detach() everywhere in your code, consider using <a href="qshareddatapointer.html">QSharedDataPointer</a> instead.</p> <!-- @@@detach --> <!-- $$$reset[overload1]$$$reset --> <h3 class="fn" id="reset"><a name="reset"></a><span class="type">void</span> QExplicitlySharedDataPointer::<span class="name">reset</span>()</h3> <p>Resets <i>this</i> to be null. i.e., this function sets the <i>d pointer</i> of <i>this</i> to 0, but first it decrements the reference count of the shared data object and deletes the shared data object if the reference count became 0.</p> <!-- @@@reset --> <!-- $$$swap[overload1]$$$swapQExplicitlySharedDataPointer<T>& --> <h3 class="fn" id="swap"><a name="swap"></a><span class="type">void</span> QExplicitlySharedDataPointer::<span class="name">swap</span>(<span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &<i>other</i>)</h3> <p>Swap this instance's explicitly shared data pointer with the explicitly shared data pointer in <i>other</i>.</p> <!-- @@@swap --> <!-- $$$take[overload1]$$$take --> <h3 class="fn" id="take"><a name="take"></a><span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">take</span>()</h3> <p>Returns a pointer to the shared object, and resets <i>this</i> to be null. That is, this function sets the <i>d pointer</i> of <i>this</i> to <code>nullptr</code>.</p> <p>This function was introduced in Qt 5.12.</p> <!-- @@@take --> <!-- $$$operator bool[overload1]$$$operator bool --> <h3 class="fn" id="operator-bool"><a name="operator-bool"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator bool</span>() const</h3> <p>Returns <code>true</code> if the <i>d pointer</i> of <i>this</i> is <i>not</i> null.</p> <!-- @@@operator bool --> <!-- $$$operator![overload1]$$$operator! --> <h3 class="fn" id="operator-not"><a name="operator-not"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator!</span>() const</h3> <p>Returns <code>true</code> if the <i>d pointer</i> of <i>this</i> is null.</p> <!-- @@@operator! --> <!-- $$$operator!=[overload1]$$$operator!=constQExplicitlySharedDataPointer<T>& --> <h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator!=</span>(const <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &<i>other</i>) const</h3> <p>Returns <code>true</code> if <i>other</i> and <i>this</i> do <i>not</i> have the same <i>d pointer</i>.</p> <!-- @@@operator!= --> <!-- $$$operator!=$$$operator!=constT* --> <h3 class="fn" id="operator-not-eq-1"><a name="operator-not-eq-1"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator!=</span>(const <span class="type">T</span> *<i>ptr</i>) const</h3> <p>Returns <code>true</code> if the <i>d pointer</i> of <i>this</i> is <i>not</i> <i>ptr</i>.</p> <!-- @@@operator!= --> <!-- $$$operator*[overload1]$$$operator* --> <h3 class="fn" id="operator-2a"><a name="operator-2a"></a><span class="type">T</span> &QExplicitlySharedDataPointer::<span class="name">operator*</span>() const</h3> <p>Provides access to the shared data object's members.</p> <!-- @@@operator* --> <!-- $$$operator->[overload1]$$$operator-> --> <h3 class="fn" id="operator--gt"><a name="operator--gt"></a><span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">operator-></span>()</h3> <p>Provides access to the shared data object's members.</p> <!-- @@@operator-> --> <!-- $$$operator->$$$operator-> --> <h3 class="fn" id="operator--gt-1"><a name="operator--gt-1"></a><span class="type">T</span> *QExplicitlySharedDataPointer::<span class="name">operator-></span>() const</h3> <p>Provides const access to the shared data object's members.</p> <!-- @@@operator-> --> <!-- $$$operator=[overload1]$$$operator=constQExplicitlySharedDataPointer<T>& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &QExplicitlySharedDataPointer::<span class="name">operator=</span>(const <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &<i>o</i>)</h3> <p>Sets the <i>d pointer</i> of <i>this</i> to the <i>d pointer</i> of <i>o</i> and increments the reference count of the shared data object. The reference count of the old shared data object of <i>this</i> is decremented. If the reference count of the old shared data object becomes 0, the old shared data object is deleted.</p> <!-- @@@operator= --> <!-- $$$operator=$$$operator=T* --> <h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &QExplicitlySharedDataPointer::<span class="name">operator=</span>(<span class="type">T</span> *<i>o</i>)</h3> <p>Sets the <i>d pointer</i> of <i>this</i> to <i>o</i> and increments <i>o</i>'s reference count. The reference count of the old shared data object of <i>this</i> is decremented. If the reference count of the old shared data object becomes 0, the old shared data object is deleted.</p> <!-- @@@operator= --> <!-- $$$operator=$$$operator=QExplicitlySharedDataPointer<T>&& --> <h3 class="fn" id="operator-eq-2"><a name="operator-eq-2"></a><span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &QExplicitlySharedDataPointer::<span class="name">operator=</span>(<span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &&<i>other</i>)</h3> <p>Move-assigns <i>other</i> to this <a href="qexplicitlyshareddatapointer.html">QExplicitlySharedDataPointer</a> instance.</p> <p>This function was introduced in Qt 5.2.</p> <!-- @@@operator= --> <!-- $$$operator==[overload1]$$$operator==constQExplicitlySharedDataPointer<T>& --> <h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator==</span>(const <span class="type"><a href="qexplicitlyshareddatapointer.html#QExplicitlySharedDataPointer">QExplicitlySharedDataPointer</a></span><<span class="type">T</span>> &<i>other</i>) const</h3> <p>Returns <code>true</code> if <i>other</i> and <i>this</i> have the same <i>d pointer</i>.</p> <!-- @@@operator== --> <!-- $$$operator==$$$operator==constT* --> <h3 class="fn" id="operator-eq-eq-1"><a name="operator-eq-eq-1"></a><span class="type">bool</span> QExplicitlySharedDataPointer::<span class="name">operator==</span>(const <span class="type">T</span> *<i>ptr</i>) const</h3> <p>Returns <code>true</code> if the <i>d pointer</i> of <i>this</i> is <i>ptr</i>.</p> <!-- @@@operator== --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>