mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-16 17:47:02 +03:00
Move std::char8_t to library section.
This commit is contained in:
14
CPP20.md
14
CPP20.md
@@ -13,7 +13,6 @@ C++20 includes the following new language features:
|
||||
- [class types in non-type template parameters](#class-types-in-non-type-template-parameters)
|
||||
- [constexpr virtual functions](#constexpr-virtual-functions)
|
||||
- [explicit(bool)](#explicitbool)
|
||||
- [char8_t](#char8_t)
|
||||
- [immediate functions](#immediate-functions)
|
||||
- [using enum](#using-enum)
|
||||
|
||||
@@ -30,6 +29,7 @@ C++20 includes the following new library features:
|
||||
- [std::bit_cast](#stdbit_cast)
|
||||
- [std::midpoint](#stdmidpoint)
|
||||
- [std::to_array](#stdto_array)
|
||||
- [char8_t](#char8_t)
|
||||
|
||||
## C++20 Language Features
|
||||
|
||||
@@ -298,12 +298,6 @@ foo b = "123"; // ERROR: explicit constructor is not a candidate (explicit speci
|
||||
foo c {"123"}; // OK
|
||||
```
|
||||
|
||||
### char8_t
|
||||
Provides a standard type for representing UTF-8 strings.
|
||||
```c++
|
||||
char8_t utf8_str[] = u8"\u0123";
|
||||
```
|
||||
|
||||
### Immediate functions
|
||||
Similar to `constexpr` functions, but functions with a `consteval` specifier must produce a constant. These are called `immediate functions`.
|
||||
```c++
|
||||
@@ -493,6 +487,12 @@ int a[] = {1, 2, 3};
|
||||
std::to_array(a); // returns `std::array<int, 3>`
|
||||
```
|
||||
|
||||
### char8_t
|
||||
Provides a standard type for representing UTF-8 strings.
|
||||
```c++
|
||||
char8_t utf8_str[] = u8"\u0123";
|
||||
```
|
||||
|
||||
## 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