I got a compiler error and noticed something interesting. For some reason unique_ptr
has an overload for auto_ptr
, but I thought auto_ptr
was deprecated:
/usr/local/include/c++/4.9.0/bits/unique_ptr.h:228:2:
note:template<class _Up, class>
std::unique_ptr<_Tp, _Dp>::unique_ptr(std::auto_ptr<_Up>&&)
unique_ptr(auto_ptr<_Up>&& __u) noexcept;
/usr/local/include/c++/4.9.0/bits/unique_ptr.h:228:2:
note: template argument deduction/substitution failed:
main.cpp:41:67: note: mismatched types 'std::auto_ptr<T>' and 'char*'
Is this because of backwards compatibility with code that used auto_ptr
?
Yes, it's for interop with auto_ptr, and deprecated means (according to the standard)
Normative for the current edition of the Standard, but not guaranteed to be part of the Standard in future revisions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With