Skip to content

Commit d9b9989

Browse files
Move char8_t to the language features section; add char32_t and char16_t.
1 parent ee2b577 commit d9b9989

File tree

3 files changed

+30
-14
lines changed

3 files changed

+30
-14
lines changed

CPP11.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ C++11 includes the following new language features:
3434
- [ref-qualified member functions](#ref-qualified-member-functions)
3535
- [trailing return types](#trailing-return-types)
3636
- [noexcept specifier](#noexcept-specifier)
37+
- [char32_t and char16_t](#char32_t-and-char16_t)
3738

3839
C++11 includes the following new library features:
3940
- [std::move](#stdmove)
@@ -688,6 +689,13 @@ void g() noexcept {
688689
}
689690
```
690691

692+
### char32_t and char16_t
693+
Provides standard types for representing UTF-8 strings.
694+
```c++
695+
char32_t utf8_str[] = U"\u0123";
696+
char16_t utf8_str[] = u"\u0123";
697+
```
698+
691699
## C++11 Library Features
692700

693701
### std::move

CPP20.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ C++20 includes the following new language features:
1717
- [immediate functions](#immediate-functions)
1818
- [using enum](#using-enum)
1919
- [lambda capture of parameter pack](#lambda-capture-of-parameter-pack)
20+
- [char8_t](#char8_t)
2021

2122
C++20 includes the following new library features:
2223
- [concepts library](#concepts-library)
@@ -31,7 +32,6 @@ C++20 includes the following new library features:
3132
- [std::bit_cast](#stdbit_cast)
3233
- [std::midpoint](#stdmidpoint)
3334
- [std::to_array](#stdto_array)
34-
- [char8_t](#char8_t)
3535

3636
## C++20 Language Features
3737

@@ -412,6 +412,12 @@ auto f(Args&&... args){
412412
}
413413
```
414414
415+
### char8_t
416+
Provides a standard type for representing UTF-8 strings.
417+
```c++
418+
char8_t utf8_str[] = u8"\u0123";
419+
```
420+
415421
## C++20 Library Features
416422

417423
### Concepts library
@@ -559,12 +565,6 @@ int a[] = {1, 2, 3};
559565
std::to_array(a); // returns `std::array<int, 3>`
560566
```
561567

562-
### char8_t
563-
Provides a standard type for representing UTF-8 strings.
564-
```c++
565-
char8_t utf8_str[] = u8"\u0123";
566-
```
567-
568568
## Acknowledgements
569569
* [cppreference](http://en.cppreference.com/w/cpp) - especially useful for finding examples and documentation of new library features.
570570
* [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.

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ C++20 includes the following new language features:
1717
- [immediate functions](#immediate-functions)
1818
- [using enum](#using-enum)
1919
- [lambda capture of parameter pack](#lambda-capture-of-parameter-pack)
20+
- [char8_t](#char8_t)
2021

2122
C++20 includes the following new library features:
2223
- [concepts library](#concepts-library)
@@ -31,7 +32,6 @@ C++20 includes the following new library features:
3132
- [std::bit_cast](#stdbit_cast)
3233
- [std::midpoint](#stdmidpoint)
3334
- [std::to_array](#stdto_array)
34-
- [char8_t](#char8_t)
3535

3636
C++17 includes the following new language features:
3737
- [template argument deduction for class templates](#template-argument-deduction-for-class-templates)
@@ -107,6 +107,7 @@ C++11 includes the following new language features:
107107
- [ref-qualified member functions](#ref-qualified-member-functions)
108108
- [trailing return types](#trailing-return-types)
109109
- [noexcept specifier](#noexcept-specifier)
110+
- [char32_t and char16_t](#char32_t-and-char16_t)
110111

111112
C++11 includes the following new library features:
112113
- [std::move](#stdmove)
@@ -505,6 +506,12 @@ auto f(Args&&... args){
505506
}
506507
```
507508
509+
### char8_t
510+
Provides a standard type for representing UTF-8 strings.
511+
```c++
512+
char8_t utf8_str[] = u8"\u0123";
513+
```
514+
508515
## C++20 Library Features
509516

510517
### Concepts library
@@ -652,12 +659,6 @@ int a[] = {1, 2, 3};
652659
std::to_array(a); // returns `std::array<int, 3>`
653660
```
654661

655-
### char8_t
656-
Provides a standard type for representing UTF-8 strings.
657-
```c++
658-
char8_t utf8_str[] = u8"\u0123";
659-
```
660-
661662
## C++17 Language Features
662663

663664
### Template argument deduction for class templates
@@ -1924,6 +1925,13 @@ void g() noexcept {
19241925
}
19251926
```
19261927

1928+
### char32_t and char16_t
1929+
Provides standard types for representing UTF-8 strings.
1930+
```c++
1931+
char32_t utf8_str[] = U"\u0123";
1932+
char16_t utf8_str[] = u"\u0123";
1933+
```
1934+
19271935
## C++11 Library Features
19281936

19291937
### std::move

0 commit comments

Comments
 (0)