C ++ 20への道

画像 本日、7月10日から15日にトロントで開催されたISO WG21 C ++委員会の夏の会議が終了しました。 すぐにRG21から詳細なレポートを受け取る可能性あり、今日、尊敬される一般の人々は、最も興味深いものについての議論とともにポスト「ウォームアップ」するよう招待されます。



会議の結果は次のとおりです。C++ 17標準が完成し、今年の11月の次の会議で公開されます。 C ++ 20標準は、最初の重要な機能- 概念明示的な汎用ラムダ -をすでに取得しており、これはほんの始まりにすぎません。



新しいC ++ 17標準の機能は度も議論されてきました。 彼らはHabréの技術革新について書き会議レポートを実施しました。 このC ++リリースの主な機能が、最も「おいしい」機能を不確実な未来に移したことであることは秘密ではありません。 さて、今では待望の「機能」の多くがC ++ 20に移行したと言っても安全です。 stdlibを拡張するための講座はどこにも行っていないため、C ++ 20からは、はるかに大きく豊富な関数セットが期待できます。





ドラフトC ++ 20標準



コンセプト



かつてC ++ 11に含まれていなかった、新しいConcepts-Liteのオファーとしてやり直された、長い間苦労してきたConceptsは 、ついに標準の一部になりつつあります。



委員会は、概念の簡潔な構文(簡潔な構文)に同意できませんでした。 ただし、議論はC ++ 20内で継続されます。



_VA_OPT_



#define LOG(msg, ...) printf(msg __VA_OPT__(,) __VA_ARGS__)

LOG("hello world")   // => printf("hello world")
LOG("hello world", ) // => printf("hello world")
LOG("hello %d", n)   // => printf("hello %d", n)
      
      







- (Explicit generic lambdas) [pdf]



[] <typename T> (T t) { /* ... */ }
      
      





- C++11, ; C++14 - auto:

[](auto x) { /* ... */ }
      
      





( ) — - :


[]<typename T>(T x) { /* ... */ }
[]<typename T>(T* p) { /* ... */ }
[]<typename T, int N>(T (&a)[N]) { /* ... */ }

      
      







shared_ptr [pdf]



shared_ptr<double[]> p = make_shared<double[]>(1024);
      
      





— , 1.





— , , :

enum class endian
{
  little = __ORDER_LITTLE_ENDIAN__,
  big    = __ORDER_BIG_ENDIAN__,
  native = __BYTE_ORDER__
};
      
      







(designated initializer) [pdf]



struct A { int x; int y; int z; }; A b{.x = 1, .z = 2};
      
      







(default bit-field initializers)



struct S {int x : 8 = 42;};
      
      





, «in-class initialization» C++11: declarator .



const-qualified



struct X { void foo() const&; };
X{}.foo();        // this is okay
(X{}.*&X::foo)(); // ill-formed in C++17, well-formed in C++2a
      
      









vector v{vector{1, 2}};
 //  vector<int>  vector<vector<int>>
      
      







TS (Technical Specifications)





TS ++17 ( ):





, , ( ):



TS, .

— , , — ++20.



(Modules) [pdf]



- , , — TS . ( ) — .. - Microsoft . , , .



Concurrency v1 [pdf]



, , — TS ++20. , futures ( std::async), latches, atomic smart pointers atomic_shared_ptr. ++17 , .

MS Visual Studio, HPX just::thread. , P0676 P0701 TS .



Transactional Memory v1 [pdf]



, TS , shared_ptr , . , - .



Library Fundamentals v2



. , ++20.



Executors v1 [pdf]



. ++20, .. TS , .



Reflection v1 [pdf]



. ++20, .



TS ( ) (reification). , TS , Boost::Hana — .



Concurrency v2



. concurrent data structures, oncurrent queues, lock-free ; Hazard pointers ( ), RCU ( lock-free ), atomic views. ++20 , .. — , , .



Parallelism v2



. , Parallelism v1 Parallel STL CPU, GPU. Parallelism v2 —



Library Fundamentals v3



.



Contracts v1



. TS, ++20. : assert, - - (.. ). , ++ , , , - .



Numerics [pdf]



. - ++20: decimal floating point, bounded types (, fixed point types), unbounded types, multiprecision arithmetic. (, , , ).



2D Graphics v1



.





std::string — starts_with, ends_with.



, TS . , CUDA/OpenMP/OpenCL C++. , std::invoke, std::async, . , std::thread CPU; , Executors TS , , .



Google, NVidia, Codeplay NASDAQ TS, ++, : Concurrency, Parallelism, Transactional Memory, Networking.



, C++20, .





, .

Michael Wong — What's in C++20 and the C++17 final score card



2017 Toronto ISO C++ Committee Discussion Thread (Concepts in C++20; Coroutines, Ranges and Networking TSes published)

C++17: The Language Features — Nicolai Josuttis

Trip report: Summer ISO C++ standards meeting (Toronto)



All Articles