CppCon 2014: Scott Meyers "Type Deduction and Why You Care"

  Рет қаралды 107,202

CppCon

CppCon

9 жыл бұрын

www.cppcon.org
-
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2014
--
C++98 had template type deduction, and it worked so intuitively, there was little need to understand what took place under the covers. C++11 extends type deduction to include universal references, applies it to auto variables and lambda expressions, then throws in a special auto-only deduction rule. C++14 pushes the boundary further, adding two forms of function return type deduction (auto and decltype(auto)) for arbitrary functions and offering auto parameters for lambdas. The result is that what could be treated as a black box in C++98 has become a topic that practicing C++ developers really need to understand. This talk will give you the information you need to do that.
--
Scott Meyers has been working with C++ since 1988. He recently finished his new book, "Effective Modern C++".
--
Videos Filmed & Edited by Bash Films: www.BashFilms.com
*-----*
Register Now For CppCon 2022: cppcon.org/registration/
*-----*

Пікірлер: 75
@fmatthew5876
@fmatthew5876 9 жыл бұрын
Scott's talks make me shake my head in despair at the design decisions and complexity of the C++ type system.
@sunilpatidar5641
@sunilpatidar5641 Ай бұрын
Just came here to revise the first two chapters of effective modern c++ by this guy himself.
@gast128
@gast128 7 жыл бұрын
Good talk though it seems to me that those C++ committee members actually don't make things simple as possible. Do they realize that ordinary C++ programmers have to deal with the domain and application complexity as well on top of all these rules?
@maxx666mayhem
@maxx666mayhem 8 жыл бұрын
Excellent video about an exciting feature in C++11 ... thanks for uploading
@erikvanvelzen
@erikvanvelzen 9 жыл бұрын
Great talk. This is simple and we're all supposed to know this, yet it is so refreshing to see it all mentioned in once place.
@danteslog5887
@danteslog5887 Жыл бұрын
Simple is once you understand it , I had to read the chapter 2 to 3 times but once I got it , it was simple 😢
@thestarinthesky_
@thestarinthesky_ 7 ай бұрын
Great talk! Too bad we don't get to see you in CppCon anymore :( Thanks for all the wonderful works you've done!
@jianwang4188
@jianwang4188 5 жыл бұрын
Wonderful! It is not easy to be one C++ expert who is always syncing with latest standardization.
@rationalcoder
@rationalcoder 8 жыл бұрын
He has always seemed to me to be quite full of himself, but he is an undeniably good presenter. Great talk!
@llothar68
@llothar68 7 жыл бұрын
Yeah, definitely the guy you want to have as a teacher but never as someone to join you when drinking a beer. Not sure about Herb Sutter but about Scott.
@davidward6779
@davidward6779 6 жыл бұрын
I think he's earned the right to be sure in his abilities.
@karas44
@karas44 2 жыл бұрын
Wondeful talk in CPP histroy!
@enricomariadeangelis2130
@enricomariadeangelis2130 5 жыл бұрын
This man is amazing!
@georganatoly6646
@georganatoly6646 2 жыл бұрын
'back in my day' (with C) to make a generic interface you made the underlying structs and funcs an int or long and let someone else build some more specialized wrappers on top that by explicitly casting and packing their arbitrary data types into those ints, in effect treating an int or long or w/e as if they were assembly-like general registers, so that users of the higher level wrappers didn't have to worry about any implicit type deduction rules and the implementers didn't have to worry about edge cases cropping up unexpectedly (this was in effect using C's version of inheritance combined with C's much stronger encapsulation to achieve the same effect, trading quick but complicated/possibly brittle templates with slower, explicit, but more strictly defined generics)
@treyquattro
@treyquattro 6 жыл бұрын
at 34:48 when someone in the audience points out a mistake and Scott acknowledges it, has the slide been updated because it looks correct to me based on what it says and what Scott has been saying prior.
@think2086
@think2086 3 жыл бұрын
I think so.
@michaelmorris2300
@michaelmorris2300 6 жыл бұрын
C++ will soon stand for convoluted ++
@NonTwinBrothers
@NonTwinBrothers 9 ай бұрын
Excellent talk by Richard Clayderman!! 😊
@antiHUMANDesigns
@antiHUMANDesigns 5 жыл бұрын
I think Luke Skywalker when I see his hair.
@berajpatel8081
@berajpatel8081 4 жыл бұрын
Thank you Scott
@magetaaaaaa
@magetaaaaaa Жыл бұрын
I don't know much about the industry, but isn't this guy some C++ legend or something? Lol.
@ulidtko
@ulidtko 9 жыл бұрын
Agreed. The type system of C++ is becoming a really screwed dump.
@gareginasatryan6761
@gareginasatryan6761 7 жыл бұрын
Maxim Ivanov not worse than javascipt
@andreitolkachev8295
@andreitolkachev8295 2 жыл бұрын
@@gareginasatryan6761 Difference is, nobody really gives a shit about performance in such languages (JS, Python), but for C++ which is supposed to be a high-performance language, it's bad indeed.
@joe-ti8rz
@joe-ti8rz 7 жыл бұрын
dankjewel meneer maand 3 zit erop
@logicboard7746
@logicboard7746 Жыл бұрын
This is truly attending a C++ class at a college
@ayseryucel
@ayseryucel 5 жыл бұрын
@CppCon i can see Scott point this and that in the slide but can't see anything what he is pointing on the slide placed on the left side of the video. it makes it hard to follow.
@arkadye
@arkadye 9 жыл бұрын
The webpage he gave says He-Man won it, just.
@Runoratsu
@Runoratsu 6 жыл бұрын
And deservedly so! He should really cosplay as He-Man sometime, it would be hilarious… :D
@jakobullmann7586
@jakobullmann7586 3 жыл бұрын
To be honest, I like N3922... Immediately before slide 20 I thought: "This does not make sense." And then slide 20 came: "Yeah, that's how it should be."
@disk0__
@disk0__ 5 жыл бұрын
Even after I double checked the video and the hair was different, Scott is always Double Dream Feet in my mind
@sanjuuyonsai
@sanjuuyonsai 9 жыл бұрын
no conclusion of the hair poll?
@Dziaji
@Dziaji 2 жыл бұрын
At 35:00, there are literally no >= 1 in the entire slide. It says >1, just like he meant it to. The comment from the audience is wrong, and Scott agreed for some strange reason.
@andreitolkachev8295
@andreitolkachev8295 2 жыл бұрын
The slides in the video are updated
@blazsovdat6433
@blazsovdat6433 8 жыл бұрын
Do we have an explanation regarding why is there a special auto rule for doing type deduction for braced initializers?
@tetramaximum
@tetramaximum 6 жыл бұрын
Blaž Sovdat yes, we do. en.cppreference.com/w/cpp/language/direct_initialization see the second form.
@timwhite7127
@timwhite7127 8 ай бұрын
Actually, when you brought up the hair topic my mind went straight to John Fogerty.
@hanyanglee9018
@hanyanglee9018 2 жыл бұрын
The whole thing needs an overhaul. If some way of programming doesn't make any sense, it should be a compiling error, not a weird deduction rule. If auto were always without any vcr and if there is any implicit conversion, it's at least a warning, the rules would be way less. An analog is the == in javascript. It tries to help but only messes.
@hanyanglee9018
@hanyanglee9018 2 жыл бұрын
Do we have a new talk on c++20 concept and constrains?
@hakoo2700
@hakoo2700 4 жыл бұрын
amazing! tnx >_
@mwont
@mwont 8 жыл бұрын
and i thought that type deduction was easy. i was so wrong!
@pspimf
@pspimf 7 жыл бұрын
Slide 17 is missing in the video, unfortunately
@jochen_schueller
@jochen_schueller 4 жыл бұрын
The standard doesn't guarantee that slides have to be contiguously allocated, it only requires a strict order. If you really need to iterate via raw page numbers without being at risk of a page fault, consider using a book or journal instead.
@HarikrishnaNalla9
@HarikrishnaNalla9 3 жыл бұрын
A confident programmer swag at 49:41
@alexeybeloushko7240
@alexeybeloushko7240 6 жыл бұрын
is it something with me? or auto x3 {17} was unintentional due to bugs in lexer? and than to cover for it necroSoft put a proposal in N9322 ?
@movax20h
@movax20h 4 жыл бұрын
It was supposed to work, because 'int x3{17}' works. Why one earth would you write 'int x3{17}', and want it to fail to compile with can't initialize int from initalizer_list.
@anon_y_mousse
@anon_y_mousse 10 ай бұрын
@@movax20h I think he meant the syntax of `type t { ... }` as opposed to the much better syntax of `type t = { ... }`. At least I hope he means that because I personally detest that form of object construction and equally the method of type inference that C++ incorporates.
@soulstudiosmusic
@soulstudiosmusic 9 жыл бұрын
Another title: "Type deduction and why you probably shouldn't use it, because it's convoluted, difficult to ascertain, subject to change and probably will only save you a few lines of code at the cost of long-term code reuse and ability to interpret code".
@lincolnsand5127
@lincolnsand5127 4 жыл бұрын
Ehhhh. Not really true at all. Auto doesn't allow the kinds of bugs that explicit types introduce. He recommends using it in "code::dive C++14 for embedded"
@wpavada3247
@wpavada3247 7 жыл бұрын
can someone explain what he said at 27:44 ?
@brainplot
@brainplot 5 жыл бұрын
"[...] so they're only ignored if you're making a completely independent value."
@user-vs6kl8ph5v
@user-vs6kl8ph5v 10 ай бұрын
the opening speech 😭
@Legorz3373
@Legorz3373 10 ай бұрын
Slides 17 and 37 missing
@Babs42
@Babs42 6 жыл бұрын
He forgot Michael Angelo Batio (MAB).
@almighty1984
@almighty1984 11 ай бұрын
Being Swedish, to me he looks like a cross between Ted Gärdestad and Christer Petterson (w/o the alcoholism)
@esad9341
@esad9341 7 жыл бұрын
as awesome as Scott is, I still prefer c
@GeorgeTsiros
@GeorgeTsiros 5 жыл бұрын
can we use different names for rvalue and lvalue? after a while it gets tiring trying to follow the speaker >_
@Webfra14
@Webfra14 5 жыл бұрын
I suggest ^nanana and °nanana...
@anon_y_mousse
@anon_y_mousse 10 ай бұрын
How about can and not? Can for l-value because you can assign, and not for r-value.
@pavel_trpn
@pavel_trpn 10 ай бұрын
At 33:35 he looked exactly like John Bon Jovi!!!
@apivovarov2
@apivovarov2 7 ай бұрын
Guy has switched to D. is it true???
@Spiderboydk
@Spiderboydk 9 жыл бұрын
Oh god, this is a mess. This is more complicated than SFINAE :-)
@d46512
@d46512 6 жыл бұрын
If he got a haircut Scott would look and sound just like Peter Gregory!
@mohammedj2941
@mohammedj2941 3 жыл бұрын
Exactly. Although I don't know who Peter Gregory is.
@risingpower
@risingpower 8 жыл бұрын
he needs some conditioner
@ulidtko
@ulidtko 9 жыл бұрын
"Type deduction _of C++_ ..." you mean, right? In other languages (which have type system more powerfull than C++'s and yet don't undergo uncontrollable complexity blowup) type inference is a very helpful tool, used daily with joy.
@eddykohlmann471
@eddykohlmann471 2 жыл бұрын
Standup ++
@JanPBtest
@JanPBtest 8 жыл бұрын
Two reasons: (1) Life is complicated so anything that's going to do even halfass job at modelling it WILL be complicated. Just ask any physicist. (2) C++ cannot introduce features in the best and easiest possible way because of a certain real-life constraint called "backward compatibility". It's simply impossible to suddenly declare millions of line of code out there invalid because of some gorgeous theoretical advance in language development.
@jasonli1194
@jasonli1194 5 жыл бұрын
a braced initialiser has no type
@Webfra14
@Webfra14 5 жыл бұрын
naaaaah... you didn't say it three times... you didn't really mean it...
@rnk1415
@rnk1415 6 жыл бұрын
Life was good till the type system of C++ is screwed.
code::dive conference 2014 - Scott Meyers: Cpu Caches and Why You Care
1:16:58
NOKIA Technology Center Wrocław
Рет қаралды 186 М.
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 71 МЛН
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 23 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 22 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 115 МЛН
CppCon 2019: Jason Turner “The Best Parts of C++"
58:36
CppCon
Рет қаралды 90 М.
Dconf 2014 Day 2 Keynote: The Last Thing D Needs -- Scott Meyers
54:55
The D Language Foundation
Рет қаралды 17 М.
Factorio teaches you software engineering, seriously.
21:27
Tony Zhu
Рет қаралды 1,4 МЛН
Every Programming Language Ever Explained in 15 Minutes
15:29
Flash Bytes
Рет қаралды 290 М.
Scott Meyers: A Unique Perspective on C++
10:36
OnSoftware
Рет қаралды 75 М.
why do header files even exist?
10:53
Low Level Learning
Рет қаралды 378 М.
DConf 2017 Day 2 Keynote: Things that Matter -- Scott Meyers
1:06:37
The D Language Foundation
Рет қаралды 12 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Clowns abuse children#Short #Officer Rabbit #angel
00:51
兔子警官
Рет қаралды 71 МЛН