Added C++20 mathematical constants.

This commit is contained in:
Anthony Calandra
2020-02-22 16:27:51 -05:00
parent c918dbea71
commit 47733e4e29
2 changed files with 16 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ C++20 includes the following new library features:
- [synchronized buffered outputstream](#synchronized-buffered-outputstream)
- [std::span](#stdspan)
- [bit operations](#bit-operations)
- [math constants](#math-constants)
## C++20 Language Features
@@ -418,6 +419,13 @@ std::popcount(1u); // 1
std::popcount(0b1111'0000u); // 4
```
### math constants
Mathematical constants including PI, Euler's number, etc. defined in the `<numbers>` header.
```c++
std::numbers::pi; // 3.14159...
std::numbers::e; // 2.71828...
```
## Acknowledgements
* [cppreference](http://en.cppreference.com/w/cpp) - especially useful for finding examples and documentation of new library features.
* [C++ Rvalue References Explained](http://thbecker.net/articles/rvalue_references/section_01.html) - a great introduction I used to understand rvalue references, perfect forwarding, and move semantics.

View File

@@ -22,6 +22,7 @@ C++20 includes the following new library features:
- [synchronized buffered outputstream](#synchronized-buffered-outputstream)
- [std::span](#stdspan)
- [bit operations](#bit-operations)
- [math constants](#math-constants)
C++17 includes the following new language features:
- [template argument deduction for class templates](#template-argument-deduction-for-class-templates)
@@ -510,6 +511,13 @@ std::popcount(1u); // 1
std::popcount(0b1111'0000u); // 4
```
### math constants
Mathematical constants including PI, Euler's number, etc. defined in the `<numbers>` header.
```c++
std::numbers::pi; // 3.14159...
std::numbers::e; // 2.71828...
```
## C++17 Language Features
### Template argument deduction for class templates