HomeОбразованиеRelated VideosMore From: CppCon

CppCon 2017: Jason Turner “Practical C++17”

329 ratings | 26904 views
http://CppCon.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/CppCon/CppCon2017 — C++17 adds many new features: structured bindings, deduction guides, if-init expressions, fold expressions, if constexpr, and enhanced constexpr support in the standard library. Each of these features are interesting, but what will be their cumulative effect on real code? We'll explore how each feature may (or may not) help in real code for enhanced readability, compile time performance and runtime performance. — Jason Turner: Developer, Trainer, Speaker Host of C++Weekly https://www.youtube.com/c/JasonTurner-lefticus, Co-host of CppCast http://cppcast.com, Co-creator and maintainer of the embedded scripting language for C++, ChaiScript http://chaiscript.com, and author and curator of the forkable coding standards document http://cppbestpractices.com. I'm available for contracting and onsite training. — Videos Filmed & Edited by Bash Films: http://www.BashFilms.com
Html code for embedding videos on your blog
Text Comments (40)
Jimmy Bazooka (11 days ago)
@ 41:02 "It is doing exactly what I needed to do and is correct". Sorry, no, it's not correct. You have no unexpanded parameter pack there. "node" parameter should have been "const AST_Node_Impl<Tracer<T>>*... node" for your fold expression to compile.
Maru (3 months ago)
Drinking game! Have a shot every time he says "thing"
How About (5 months ago)
namespace ParentNamespace:: {} ? @ 9:00
Karoly Horvath (6 months ago)
I honestly don't get why they added if-init. It looks like a mess and we already have braces { } to create an inner scope.
Karoly Horvath (3 months ago)
Good for you.
Mykola Krachkovsky (3 months ago)
So, IMHO, if with init does more good, than bad, as extra nesting/indentation blurs the focus more than one complex if.
Mykola Krachkovsky (3 months ago)
Kind of agree, that `if (init expr; condition)` not very conventional, though it mimics `for(init expr; condition; increment)`. As for `if (type var = condition)` — can't see any problem.
Karoly Horvath (3 months ago)
6:30 - perfect example for horrible readability. But to spell out the differences: for(init; ..) vs if(expr) also, "for" can't have an else clause...
Mykola Krachkovsky (3 months ago)
Karoly Horvath and what is difference between if(type var = ...) and for(type var...)? Both could be replaced by { type var = ...; if/for(); } and both have the same readability, seriously, what's wrong with a readability of if(auto x = something_nullable) { do something with x; }
crystalgames (6 months ago)
thanks)
Cas Snel/informatie (8 months ago)
Perspective. I understand more of The game of thrones than of this talk. Il still win.
Abdulelah Al Jeffery (1 year ago)
5:17 when the talk starts.
____x____ (1 year ago)
What he is talking about at 35:00-37:17? Compiler explorer tells us that compilers can easily optimize returning "subobject of pair": https://godbolt.org/g/937yr8
____x____ (1 year ago)
Yeah, I already talked with colleagues, one told me this is the case with large objects/subobjects.
Dima Rusyy (1 year ago)
Did you try pair of strings as Jason does instead of int's ? See https://stackoverflow.com/questions/9183087/will-member-subobjects-of-local-variables-be-moved-too-if-returned-from-a-functi
piotrarturklos (1 year ago)
He says he's a Microsoft MVP, but when I search for jason turner on the microsoft mvp website, I can't find him.
X Baron (4 months ago)
A mononymic email address is what you want if you want to be taken seriously. The only thing better is if you're known by a three letter acronym. :)
Jason Turner (11 months ago)
Strange, I'll try and fix that.
piotrarturklos (1 year ago)
That's hilarious, it appears as if he is *the* Jason and other Jasons are not important anymore. :)
He is just under the name "Jason" for some reason, but here is his profile there: https://mvp.microsoft.com/en-us/PublicProfile/5001441?fullName=Jason
Sonu Lohani (1 year ago)
Thanks to this channel for sharing such an awesome presentations. Very much appreciated.
Nikolay Mihaylov (1 year ago)
Great talk, I love it. This is why I do not use C++17 yet. Second reason is lack of standard compiler support in CentOS 6
Nikolay Mihaylov (1 year ago)
on centos 7, there is gcc 4.8, nothing new, unless you compile it yourself.
Lothar Scholz (1 year ago)
Compiler support is pretty good. But the tools are much much slower to pick up then the naked compiler. std::string_view on gcc is still crashing gdb
namespace std (1 year ago)
Nice caveats explained and elaborated... Good talk, Jason.
AJlex100500 (1 year ago)
I don't understand why the code at 47:51 should compile. Afaik std::string_view is not convertible to std::string, therefore constructing m_string from sv is not possible. So what gives?
namespace std (1 day ago)
+AJlex100500 I mean, why shouldn't it?
AJlex100500 (1 year ago)
Thanks for the answer, I didn't realize string had an explicit constructor from string_view.
Sebastian Hasler (1 year ago)
string_view is not implicity-convertible to string, but the initializer list can call explicit constructors.
beachedwhale (1 year ago)
the if syntax works well for weak_ptr's too. if( auto shptr = wptr.lock( ) ) { do stuff with shared_ptr }
MaceUA (1 year ago)
It's not the C++17 syntax, it has no ";" in the middle. This syntax has been working for many years long before C++11.
Janko Dedic (1 year ago)
Great talk by JSON, as always!
Michael Osei (1 year ago)
lol

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.