The Hidden Secrets of Move Semantics - Nicolai Josuttis - CppCon 2020

  Рет қаралды 26,919

CppCon

CppCon

Күн бұрын

Пікірлер: 27
@tux1968
@tux1968 4 жыл бұрын
This is just about the most perfect technical talk one could hope for. Very well done, thank you.
@03Prashanth
@03Prashanth 3 жыл бұрын
I finally realised when a member function parameter in a template class is a forwarding reference. Great example, thanks!
@Moriadin
@Moriadin 3 жыл бұрын
I like how he bashes the standard now and again :) it's a refreshing change.
@VoidloniXaarii
@VoidloniXaarii Жыл бұрын
Listened to this a bunch of times, still feel there's so much I'm not yet getting and must try again, thank you so very much
@bronekkozicki6356
@bronekkozicki6356 4 жыл бұрын
Nico, thank you for giving this nice example of && ref-qualifier at 46' . It was in the standard since C++11, i.e. added alongside with std::forward and std::move (and implemented in GCC since 4.8.1), so not quite new :)
@treyquattro
@treyquattro 4 жыл бұрын
it's always great to get a new video from Nicolai. He presents information in a clear style and authoritative manner. However, the fact that we're still hashing out move semantics after a decade (plus some additions to the language in the intervening years) is disappointing. If you don't have the level of expertise of someone like Nicolai then you're going to be struggling with the esoteric aspects of C++ and template parameters in particular. In this aspect C++ is a mess. It's hardly surprising that there's been a surfeit of new C++/C-like languages cropping up in the past decade or so because they're trying to make C++ less prone to errors and consequent wasting of developer time tracking down hard-to-identify bugs caused by the ambiguity in the language, especially when it comes to template classes and functions, and yes ensuring that your move & copy code works correctly everywhere. Entirely new languages like C# have made these issues beautifully straightforward, but then they didn't have to worry about backward compatibility with a huge installed codebase. I continually hope that C++ can clean up its act and become more straightforward, but all that seems to happen is that you have to invest more time and effort understanding esoteric specialties and becoming an ever-deeper C++ expert from which there's no getting out!
@JohnCLiberte
@JohnCLiberte 4 жыл бұрын
This is amazing. Love the sass he gives the commity :) and for a good reason!
@technologicalwaste7612
@technologicalwaste7612 4 жыл бұрын
Well done. Code almost within the first minute of the presentation. Some other talks have had nearly 10 minutes of introduction before the real content begins.
@martinelzen5127
@martinelzen5127 4 жыл бұрын
Thanks for highlighting the issue with using that 'new-ish' for implementation (the name of which I can't recall at the moment) with a reference to a container object. I got bitten by the same issue (though luckily with a page fault or something), and it was... well, unexpected, anyway.
@sochooligan
@sochooligan 4 жыл бұрын
CAN NOT see the effect of: 1>0x8002cd30:hello 2>0x8002cd30:hello 0x8002cd50:string1 What see is: the 2nd "hello" with different address from the 1st "hello".
@MalicePandrodor
@MalicePandrodor 4 жыл бұрын
21:48 When move can be expensive? I think you meant "when move is not available and instead a copy is always done".
@nivo6379
@nivo6379 4 жыл бұрын
`array` is an example. isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#f15-prefer-simple-and-conventional-ways-of-passing-information
@treyquattro
@treyquattro 4 жыл бұрын
45:41 does [[nodiscard]] on the function not help?
@chrisdams
@chrisdams 4 жыл бұрын
@24 mins: is this actually true? I thought that for a universal reference the method needs to be template and not the class. Thing is you call insertIf on an instance so T is already a given and I don't think it works in that case?
@chrisdams
@chrisdams 4 жыл бұрын
Ow, he actually adresses this immediately after. It indeed is not a universal reference in this case.
@aplced
@aplced 4 жыл бұрын
I am a bit puzzled by why a move on a const doesn't generate a compile time error. As mentioned in ~ 13 minute mark, there is almost (certainly?) no real life use case of const T&& it being a semantic contradiction. Why not just throw an error and eliminate possible subtle bugs.
@the_real_janvier
@the_real_janvier 6 ай бұрын
One would think the least the compiler could do is to show a "warning" during compilation.
@warrenbuckley3267
@warrenbuckley3267 4 жыл бұрын
I wish move was the default, and copy had to be done explicitly.
@nivo6379
@nivo6379 4 жыл бұрын
Move is only useful if the function needs to modify the value.
@sambatgoson6923
@sambatgoson6923 2 жыл бұрын
semantic move and forward solve some aspects but seem to make confusing.
@spinthma
@spinthma 4 жыл бұрын
Great! Greeting from germany
@Razyelgore
@Razyelgore 4 жыл бұрын
thank you so much
@EgorChebotarev
@EgorChebotarev 8 ай бұрын
cool
@nivo6379
@nivo6379 4 жыл бұрын
The point about not having const values contradicts CppCoreGuidlines which recommends tagging any constant value as const . Instead of recommending people to not use `const` , the library writers should provide the `const &&` overload. A language feature like Proposal 708 can remove the problem altogether. isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#con-constants-and-immutability github.com/hsutter/708/
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 15 МЛН
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 113 МЛН
Back to Basics: Concurrency - Arthur O'Dwyer - CppCon 2020
1:04:28
Back to Basics: Exceptions - Klaus Iglberger - CppCon 2020
1:01:45
Back to Basics: Pointers and Memory - Ben Saks - CppCon 2020
1:00:56