deprecated and deprecatedreason
suggest changeC++14 introduced a standard way of deprecating functions via attributes. [[deprecated]]
can be used to indicate that a function is deprecated. [[deprecated("reason")]]
allows adding a specific reason which can be shown by the compiler.
void function(std::unique_ptr<A> &&a);
// Provides specific message which helps other programmers fixing there code
[[deprecated("Use the variant with unique_ptr instead, this function will be removed in the next release")]]
void function(std::auto_ptr<A> a);
// No message, will result in generic warning if called.
[[deprecated]]
void function(A *a);
This attribute may be applied to:
- the declaration of a class
- a typedef-name
- a variable
- a non-static data member
- a function
- an enumeration
- a template specialization
(ref. c++14 standard draft: 7.6.5 Deprecated attribute)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents