diff --git a/CPP11.md b/CPP11.md index 63e0a93..cab5323 100644 --- a/CPP11.md +++ b/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 diff --git a/CPP20.md b/CPP20.md index d50598e..9db0f64 100644 --- a/CPP20.md +++ b/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` ``` -### 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. diff --git a/README.md b/README.md index bf2ba86..b7c4056 100644 --- a/README.md +++ b/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` ``` -### 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