RSS feeds in the directory: 2818
Added today: 0
Added yesterday: 0
the summary contents of the report Yuri Gavrilovic — "References in C++ and the issues associated with them" from the conference C++ CoreHard Winter 2017.
2:37 — about rvalue and lvalue. An informal definition from Maers:
— if you can take the address of the expression — it is an lvalue;
— are also an lvalue an lvalue–reference;
— rvalue is everything else.
4:45 — examples of lvalue and rvalue expressions with comments. In particular, an lvalue is a function of the result of operator  (square brackets). However, X () is rva lue because it is impossible to take the address (&X) (returns error)....
7:26 — an lvalue–reference ("normal" links, which were before C++11) in simple examples.
8:30 — rvalue–references (introduced in C++11 are indicated by two ampersands — &&). Such references can bind to temporary objects. They are used to: 1) remove unnecessary copying in C++; 2) to solve the problem of perfect forwarding (discussed in detail later).
9:40 — rvalue references is a separate type that can be used to overload functions.
10:30 — Then the report is built around the example here describes a class of vector. Understand "problems" in the code and ways of their decision, including:
* 14:40 — security levels exceptions in C++ (one of the problems in our example).
* 17:10 — copy and swap idiom (improves safety of okucani and code quality).
* 19:23 — problem which is solved by move–semantics. We want to assign vector to a temporary object (which possibly returns another function). This calls the copy constructor, which allocates additional memory comparet, and then the temporary object is deleted. Idea — instead of copying "borrow" data from a temporary object. In C++, you use std::move, which is of an lvalue reference does an rvalue reference.
24:40 — examples of the use of std::move. With C++11 standard containers support move–semantics. Thus, you can avoid unnecessary copies:
28:10 — Movable-only types. We can prevent copying the object (remove the copy constructor), but allow its movement. For example — unique_ptr.
31:00 — Forwarding links are special links that appears in the process output types and the result is converted to either an lvalue reference or an rvalue reference. Found in auto and in the arguments of function templates (examples).
32:55 — what work Forwarding links. Rules of inference types in the examples.
35:00 — the Problem of perfect forwarding is described very superficially. Better read here: https://habr.com/en/post/242639/
it is Also about rvalue references can be found here: https://pro-prof.com/forums/topic/cplusplus_references
Move–semantics here: https://pro-prof.com/forums/topic/move-constructor-semantic_cplusplus
To always find out about these "reviews" — https://vk.com/for_programmer
Wrote rrrfer on programming.d3.ru / comment
Flying through the shadows 07.10.2019 at 05:09
Why I don't like real estate investment 07.10.2019 at 02:09
Impartial of the Nobel prize 07.10.2019 at 01:35
The farmers are in turmoil 06.10.2019 at 23:58
Died Yevgeny Bushmin 06.10.2019 at 23:17
Left unattended cat is mated with five cats and ended up on a drip 06.10.2019 at 22:10
Beeline takes the baton from Sberbank 06.10.2019 at 21:59
Punks hoy! 06.10.2019 at 19:28