modern-cpp-tutorial icon indicating copy to clipboard operation
modern-cpp-tutorial copied to clipboard

Add C++20 Supports

Open changkun opened this issue 6 years ago • 6 comments

需要支持以下内容:

  • 语言级 bug 与修订
  • [ ] 类型系统改进 Type Punning
  • [x] 弃用和删除的功能
    • register
    • std::auto_ptr --> std::unique_ptr
    • std::random_shuffle
    • std::bind1st, std::bind2nd, ...
  • 语言增强
  • [x] 结构化绑定 Structured bindings
  • [x] 新的控制结构 constexpr if
  • [x] 编译时条件语句 Compile-time conditional statements
  • [ ] 新的聚合规则
  • [ ] 强制性 RVO 和复制 elision, Guaranteed copy elision
  • [ ] Unary static_assert
  • [ ] 嵌套命名空间 Nested namespace deinitions
  • [ ] inline 变量 inline variables
  • [ ] constexpr 改进, constexpr lambda
  • 模板增强
  • [x] 折叠表达式 Fold expressions
  • [x] 类模板参数推导 Class template deduction
  • [x] variadic templates fold
  • [x] auto non-type template parameters
  • [ ] ~~Preprocessor predicate for header testing~~
  • 容器
  • [ ] std::string_view, std::byte 加入 container 容器一章
  • [x] std::any, std::variant, std::optional 加入 container 容器一章
  • [ ] 容器改进
  • 线程
  • 文件系统
  • [x] [文件系统库, 专门用一章来讲解](http://en.cppreference.com/w/cpp/filesystem, http://www.bfilipek.com/2017/08/cpp17-details-filesystem.html)
  • 数学库
  • 其他特性
  • [ ] Polymorphic allocators and memory resources
  • [ ] Aligned new
  • [ ] Improved insertion and splicing for associative constrainers
  • [ ] Boolean logic metafunctions ...
  • 展望 C++20
  • [x] concept
  • [x] module
  • [x] coroutine
  • [x] Ranges

changkun avatar Mar 26 '18 06:03 changkun

Suggestion for C++20 ranges:

Ranges:

The ranges library provides a new way of working with ranges of elements. To use them, you should include the header file. Let's look at ranges with an example. A range is a sequence of elements having a beginning and an end. It provides a begin iterator and an end sentinel. Consider the following vector of integers:

#include <vector>
int main()
{
    std::vector<int> elements{0, 1, 2, 3, 4, 5, 6};
}

Ranges accompanied by range adapters (the | operator) provide powerful functionality to deal with a range of elements. For example, examine the following code:

#include <vector>
#include <ranges> //works in GCC 10.1(current)
int main()
{
    std::vector<int> elements{0, 1, 2, 3, 4, 5, 6};
    for (int current : elements | std::ranges::view::filter([](int e) { return
         e % 2 == 0; }))
  {
      std::cout << current << " ";
  }
}

kassane avatar Apr 12 '20 13:04 kassane

@kassane Thank you so much!

changkun avatar Apr 12 '20 17:04 changkun

@changkun 方便发布一版中文的EPUB吗 dalao

Peilix avatar Oct 22 '20 05:10 Peilix

@Peilix https://changkun.de/modern-cpp/epub/modern-cpp-tutorial-zh-cn.epub

changkun avatar Oct 22 '20 05:10 changkun

Any progress?

Sunbreak avatar Aug 31 '21 15:08 Sunbreak

PR welcome

changkun avatar Aug 31 '21 15:08 changkun