mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-17 10:04:35 +03:00
Add explanation about C++14 [[deprecated]] standard attribute (#49)
* Add [[deprecated]] attribute to C++14
This commit is contained in:
committed by
Anthony Calandra
parent
1c60839a11
commit
9f21a120f0
10
CPP14.md
10
CPP14.md
@@ -11,6 +11,7 @@ C++14 includes the following new language features:
|
|||||||
- [decltype(auto)](#decltypeauto)
|
- [decltype(auto)](#decltypeauto)
|
||||||
- [relaxing constraints on constexpr functions](#relaxing-constraints-on-constexpr-functions)
|
- [relaxing constraints on constexpr functions](#relaxing-constraints-on-constexpr-functions)
|
||||||
- [variable templates](#variable-templates)
|
- [variable templates](#variable-templates)
|
||||||
|
- [\[\[deprecated\]\] attribute](#deprecated-attribute)
|
||||||
|
|
||||||
C++14 includes the following new library features:
|
C++14 includes the following new library features:
|
||||||
- [user-defined literals for standard library types](#user-defined-literals-for-standard-library-types)
|
- [user-defined literals for standard library types](#user-defined-literals-for-standard-library-types)
|
||||||
@@ -146,6 +147,15 @@ template<class T>
|
|||||||
constexpr T e = T(2.7182818284590452353);
|
constexpr T e = T(2.7182818284590452353);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### [[deprecated]] attribute
|
||||||
|
C++14 introduces the `[[deprecated]]` attribute to indicate that a unit (function, class, etc) is discouraged and likely yield compilation warnings. If a reason is provided, it will be included in the warnings.
|
||||||
|
```c++
|
||||||
|
[[deprecated]]
|
||||||
|
void old_method();
|
||||||
|
[[deprecated("Use new_method instead")]]
|
||||||
|
void legacy_method();
|
||||||
|
```
|
||||||
|
|
||||||
## C++14 Library Features
|
## C++14 Library Features
|
||||||
|
|
||||||
### User-defined literals for standard library types
|
### User-defined literals for standard library types
|
||||||
|
|||||||
11
README.md
11
README.md
@@ -44,6 +44,7 @@ C++14 includes the following new language features:
|
|||||||
- [decltype(auto)](#decltypeauto)
|
- [decltype(auto)](#decltypeauto)
|
||||||
- [relaxing constraints on constexpr functions](#relaxing-constraints-on-constexpr-functions)
|
- [relaxing constraints on constexpr functions](#relaxing-constraints-on-constexpr-functions)
|
||||||
- [variable templates](#variable-templates)
|
- [variable templates](#variable-templates)
|
||||||
|
- [\[\[deprecated\]\] attribute](#deprecated-attribute)
|
||||||
|
|
||||||
C++14 includes the following new library features:
|
C++14 includes the following new library features:
|
||||||
- [user-defined literals for standard library types](#user-defined-literals-for-standard-library-types)
|
- [user-defined literals for standard library types](#user-defined-literals-for-standard-library-types)
|
||||||
@@ -751,6 +752,16 @@ template<class T>
|
|||||||
constexpr T e = T(2.7182818284590452353);
|
constexpr T e = T(2.7182818284590452353);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### [[deprecated]] attribute
|
||||||
|
C++14 introduces the `[[deprecated]]` attribute to indicate that a unit (function, class, etc) is discouraged and likely yield compilation warnings. If a reason is provided, it will be included in the warnings.
|
||||||
|
```c++
|
||||||
|
[[deprecated]]
|
||||||
|
void old_method();
|
||||||
|
|
||||||
|
[[deprecated("Use new_method instead")]]
|
||||||
|
void legacy_method();
|
||||||
|
```
|
||||||
|
|
||||||
## C++14 Library Features
|
## C++14 Library Features
|
||||||
|
|
||||||
### User-defined literals for standard library types
|
### User-defined literals for standard library types
|
||||||
|
|||||||
Reference in New Issue
Block a user