📜 ⬆️ ⬇️

What was accepted in C ++ 17 is a photograph of Bjarne Straustrup and a survey for C ++ 20


In early March, the meeting of the WG21 international working group on C ++ standardization, in which Yandex employees participated, ended in the US city of Kona.
C ++ 17 "accepted"!
To be completely precise, we decided that it was time to transfer the draft C ++ 17 document to an ISO higher authority, which would issue it as a standard, or send it back to correct the formatting and some other formalities.

Sessions, as usual, took a whole day plus an additional subgroup on working with numbers.

The main time was devoted to polishing a draft of C ++ 17, but some small and interesting innovations still managed to slip into C ++ 17.


20 years waited ...


std::ofstream(L"      .txt") << u8"!";


std::optional


std::optional :
template <class T>
bool operator < (const optional<T>&, const T&);
// ...

:

optional<const int> x = 42;
int y = 666;
x == y; //  
...

optional<string> s = "Hello";
s == "Hello"; //  


, :
template <class T, class U>
bool operator < (const optional<T>&, const U&);
// ...

, 's == «Hello»' .

Deduction guides


deduction guides, :

// !     .
std::tuple      a = {42, "Hello", 3.14};
std::array      b = {1, 2, 3, 4, 5, 6, 7, 8};
std::pair       c = {42, "Hello"};
std::function   d = [](int i) { std::cout << i; };
std::set        e = {1, 2, 3, 4, 5, 6, 7, 8};

// P.S.:     '='     :)


std::array
explicit deduction guides std::array.

WG21 C++, , , explicit deduction guides std::array. , … !


std::byte


- , - « »? C ++17 std::byte
unsigned char raw_buffer[buffer_size];
std::byte raw_buffer[buffer_size];
.

,


. :



, ++ . C++17, C++20. .

Numbers TS


, , , , . Numbers TS — . :

, .

operator<=>()


operator<=>(). , C++20 :
struct foo { /*     */ };

auto operator<=>(const foo&, const foo&) = default; //      foo c foo
auto operator<=>(const foo&, const char*) = default; //      foo c const char*      const char*  foo



, //«-», , constexpr constexpr , constexpr « », , . , 21 , ++ ++17 . — WG21 C++.


C++17 , !

C++20, C++17/C++14/C++11, C++, stdcpp.ru. !

! ++ , , .

')

Source: https://habr.com/ru/post/323972/


All Articles