mirror of
https://github.com/boostorg/smart_ptr.git
synced 2025-08-02 14:14:27 +02:00
Comment corrected (thanks to Joe Gottman)
[SVN r9582]
This commit is contained in:
@@ -250,7 +250,7 @@ template<typename T> class shared_ptr {
|
|||||||
void dispose() { if (--*pn == 0) { delete px; delete pn; } }
|
void dispose() { if (--*pn == 0) { delete px; delete pn; } }
|
||||||
|
|
||||||
void share(T* rpx, long* rpn) {
|
void share(T* rpx, long* rpn) {
|
||||||
if (pn != rpn) { // assert ((pn==rpn) == (px==rpx))
|
if (pn != rpn) { // Q: why not px != rpx? A: fails when both == 0
|
||||||
dispose();
|
dispose();
|
||||||
px = rpx;
|
px = rpx;
|
||||||
++*(pn = rpn);
|
++*(pn = rpn);
|
||||||
@@ -287,7 +287,7 @@ template<typename T> class shared_array {
|
|||||||
~shared_array() { dispose(); }
|
~shared_array() { dispose(); }
|
||||||
|
|
||||||
shared_array& operator=(const shared_array& r) {
|
shared_array& operator=(const shared_array& r) {
|
||||||
if (pn != r.pn) { //assert ((pn==r.pn) == (px==r.px))
|
if (pn != r.pn) { // Q: why not px != r.px? A: fails when both px == 0
|
||||||
dispose();
|
dispose();
|
||||||
px = r.px;
|
px = r.px;
|
||||||
++*(pn = r.pn);
|
++*(pn = r.pn);
|
||||||
|
Reference in New Issue
Block a user