File tree 1 file changed +11
-4
lines changed
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -97,12 +97,12 @@ class shared_ref
97
97
98
98
size_t use_count () const noexcept
99
99
{
100
- return shared + 1 ;
100
+ return __atomic_load_n (& shared, __ATOMIC_RELAXED) + 1 ;
101
101
}
102
102
103
103
size_t weak_count () const noexcept
104
104
{
105
- return weak;
105
+ return __atomic_load_n (& weak, __ATOMIC_RELAXED) ;
106
106
}
107
107
108
108
private:
@@ -382,15 +382,15 @@ class weak_ptr
382
382
rc->keep_weak ();
383
383
}
384
384
385
- weak_ptr (weak_ptr const & r) noexcept : p(r.p), rc(r.rc)
385
+ weak_ptr (const weak_ptr & r) noexcept : p(r.p), rc(r.rc)
386
386
{
387
387
if (rc)
388
388
rc->keep_weak ();
389
389
}
390
390
391
391
template <typename U>
392
392
requires __::shared_ptr_compatible<T, U>
393
- weak_ptr (weak_ptr<U> const & r) noexcept : p(r.p), rc(r.rc)
393
+ weak_ptr (const weak_ptr<U>& r) noexcept : p(r.p), rc(r.rc)
394
394
{
395
395
if (rc)
396
396
rc->keep_weak ();
@@ -444,6 +444,13 @@ class weak_ptr
444
444
return *this ;
445
445
}
446
446
447
+ template <typename U>
448
+ requires __::shared_ptr_compatible<T, U>
449
+ weak_ptr& operator =(weak_ptr<U> r) noexcept
450
+ {
451
+ weak_ptr<T>(move (r)).swap (*this );
452
+ }
453
+
447
454
shared_ptr<T> lock () const noexcept
448
455
{
449
456
if (expired ())
You can’t perform that action at this time.
0 commit comments