mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-16 17:47:02 +03:00
Added C++20 mathematical constants.
This commit is contained in:
8
CPP20.md
8
CPP20.md
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user