aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-10-21 21:13:41 +0100
committerJonathan Wakely <jwakely@redhat.com>2020-10-21 21:13:41 +0100
commit945151b7f14c5d105abd8117f208ae9e3db91fb4 (patch)
tree3c656799177215c65dc72ae9b4a3cf9a334945f8 /gcc
parent84cc3370d6d5972fe495b2114fb32f7b4a49a98d (diff)
downloadgcc-945151b7f14c5d105abd8117f208ae9e3db91fb4.zip
gcc-945151b7f14c5d105abd8117f208ae9e3db91fb4.tar.gz
gcc-945151b7f14c5d105abd8117f208ae9e3db91fb4.tar.bz2
libstdc++: Simplify std::shared_ptr construction from std::weak_ptr
The _M_add_ref_lock() and _M_add_ref_lock_nothrow() members of _Sp_counted_base are very similar, except that the former throws an exception when the use count is zero and the latter returns false. The former (and its callers) can be implemented in terms of the latter. This results in a small reduction in code size, because throwing an exception now only happens in one place. libstdc++-v3/ChangeLog: * include/bits/shared_ptr.h (shared_ptr(const weak_ptr&, nothrow_t)): Add noexcept. * include/bits/shared_ptr_base.h (_Sp_counted_base::_M_add_ref_lock): Remove specializations and just call _M_add_ref_lock_nothrow. (__shared_count, __shared_ptr): Use nullptr for null pointer constants. (__shared_count(const __weak_count&)): Use _M_add_ref_lock_nothrow instead of _M_add_ref_lock. (__shared_count(const __weak_count&, nothrow_t)): Add noexcept. (__shared_ptr::operator bool()): Add noexcept. (__shared_ptr(const __weak_ptr&, nothrow_t)): Add noexcept.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions