mirror of
https://github.com/AnthonyCalandra/modern-cpp-features.git
synced 2025-12-16 17:47:02 +03:00
Move char8_t to the language features section; add char32_t and char16_t.
This commit is contained in:
8
CPP11.md
8
CPP11.md
@@ -34,6 +34,7 @@ C++11 includes the following new language features:
|
||||
- [ref-qualified member functions](#ref-qualified-member-functions)
|
||||
- [trailing return types](#trailing-return-types)
|
||||
- [noexcept specifier](#noexcept-specifier)
|
||||
- [char32_t and char16_t](#char32_t-and-char16_t)
|
||||
|
||||
C++11 includes the following new library features:
|
||||
- [std::move](#stdmove)
|
||||
@@ -688,6 +689,13 @@ void g() noexcept {
|
||||
}
|
||||
```
|
||||
|
||||
### char32_t and char16_t
|
||||
Provides standard types for representing UTF-8 strings.
|
||||
```c++
|
||||
char32_t utf8_str[] = U"\u0123";
|
||||
char16_t utf8_str[] = u"\u0123";
|
||||
```
|
||||
|
||||
## C++11 Library Features
|
||||
|
||||
### std::move
|
||||
|
||||
14
CPP20.md
14
CPP20.md
@@ -17,6 +17,7 @@ C++20 includes the following new language features:
|
||||
- [immediate functions](#immediate-functions)
|
||||
- [using enum](#using-enum)
|
||||
- [lambda capture of parameter pack](#lambda-capture-of-parameter-pack)
|
||||
- [char8_t](#char8_t)
|
||||
|
||||
C++20 includes the following new library features:
|
||||
- [concepts library](#concepts-library)
|
||||
@@ -31,7 +32,6 @@ 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
|
||||
|
||||
@@ -412,6 +412,12 @@ auto f(Args&&... args){
|
||||
}
|
||||
```
|
||||
|
||||
### char8_t
|
||||
Provides a standard type for representing UTF-8 strings.
|
||||
```c++
|
||||
char8_t utf8_str[] = u8"\u0123";
|
||||
```
|
||||
|
||||
## C++20 Library Features
|
||||
|
||||
### Concepts library
|
||||
@@ -559,12 +565,6 @@ 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.
|
||||
|
||||
22
README.md
22
README.md
@@ -17,6 +17,7 @@ C++20 includes the following new language features:
|
||||
- [immediate functions](#immediate-functions)
|
||||
- [using enum](#using-enum)
|
||||
- [lambda capture of parameter pack](#lambda-capture-of-parameter-pack)
|
||||
- [char8_t](#char8_t)
|
||||
|
||||
C++20 includes the following new library features:
|
||||
- [concepts library](#concepts-library)
|
||||
@@ -31,7 +32,6 @@ 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++17 includes the following new language features:
|
||||
- [template argument deduction for class templates](#template-argument-deduction-for-class-templates)
|
||||
@@ -107,6 +107,7 @@ C++11 includes the following new language features:
|
||||
- [ref-qualified member functions](#ref-qualified-member-functions)
|
||||
- [trailing return types](#trailing-return-types)
|
||||
- [noexcept specifier](#noexcept-specifier)
|
||||
- [char32_t and char16_t](#char32_t-and-char16_t)
|
||||
|
||||
C++11 includes the following new library features:
|
||||
- [std::move](#stdmove)
|
||||
@@ -505,6 +506,12 @@ auto f(Args&&... args){
|
||||
}
|
||||
```
|
||||
|
||||
### char8_t
|
||||
Provides a standard type for representing UTF-8 strings.
|
||||
```c++
|
||||
char8_t utf8_str[] = u8"\u0123";
|
||||
```
|
||||
|
||||
## C++20 Library Features
|
||||
|
||||
### Concepts library
|
||||
@@ -652,12 +659,6 @@ 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";
|
||||
```
|
||||
|
||||
## C++17 Language Features
|
||||
|
||||
### Template argument deduction for class templates
|
||||
@@ -1924,6 +1925,13 @@ void g() noexcept {
|
||||
}
|
||||
```
|
||||
|
||||
### char32_t and char16_t
|
||||
Provides standard types for representing UTF-8 strings.
|
||||
```c++
|
||||
char32_t utf8_str[] = U"\u0123";
|
||||
char16_t utf8_str[] = u"\u0123";
|
||||
```
|
||||
|
||||
## C++11 Library Features
|
||||
|
||||
### std::move
|
||||
|
||||
Reference in New Issue
Block a user