I have a method in an interface that I want to deprecate with portable C++.
When I Googled for this all I got was a Microsoft specific solution; #pragma deprecated
and __declspec(deprecated)
.
A second prize solution would be to ifdef
a MSVC and a GCC solution.
Best Answer
In C++14, you can mark a function as deprecated using the
[[deprecated]]
attribute (see section 7.6.5 [dcl.attr.deprecated]).For example, the following function
foo
is deprecated:It is possible to provide a message that describes why the name or entity was deprecated:
The message must be a string literal.
For further details, see “Marking as deprecated in C++14”.