In C++11 and draft C++14, the dereferencing operators (operator*
and operator->
) for shared_ptr
are both noexcept
. But for unique_ptr
, operator->
is noexcept
, but operator*
isn't. Why isn't operator*
for unique_ptr
noexcept
(or, alternatively, why is operator*
for shared_ptr
noexcept
)?
Asked
Active
Viewed 130 times
7

KnowItAllWannabe
- 12,972
- 8
- 50
- 91
-
1Probably relevant: http://stackoverflow.com/questions/15203541/why-does-stdunique-ptr-operator-throw-and-operator-does-not-throw – milleniumbug Feb 09 '14 at 00:07
-
@milleniumbug it is indeed a duplicate. – Feb 09 '14 at 00:10