CppCon 2017: Ben Deane & Jason Turner “constexpr ALL the Things!”
Вставка
- Опубліковано 28 лип 2024
- CppCon.org
-
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2017
-
constexpr: in C++11, a curiosity; in C++14, viable for more uses; now with added power, in C++17 will it become an important tool in the programmer's toolkit?
In this talk we will examine the possibilities and power of constexpr and explore what can (and what should) be done at compile-time with C++17. We'll present techniques for building constexpr data structures and algorithms, and look at what the standard provides and where it can improve. We'll also explore constexpr use of user defined literals for expressive compile-time abstractions.
Compile-time computation offers perhaps the ultimate zero-cost abstraction, and this talk attempts to gauge the power available with C++17 constexpr.
-
Ben Deane: Principal Software Engineer, Blizzard Entertainment
Ben has been writing games for almost 20 years, and in C++ for most of that. He is currently a Principal Engineer at Blizzard Entertainment where he works on the Battle.net team. He's always looking for useful new techniques in C++, and he likes functional programming.
Jason Turner: Developer, Trainer, Speaker
Host of C++Weekly / jasonturner-lefticus , Co-host of CppCast cppcast.com, Co-creator and maintainer of the embedded scripting language for C++, ChaiScript chaiscript.com, and author and curator of the forkable coding standards document cppbestpractices.com.
I'm available for contracting and onsite training.
-
Videos Filmed & Edited by Bash Films: www.BashFilms.com
*-----*
Register Now For CppCon 2022: cppcon.org/registration/
*-----*
"There was a misunderstanding between me and the compiler".
How polite of him to address Mr. Compiler like that.
For rest of us compiler is a real bitch.
Great talk by Ben and JSON, as always!
Json hahahaha
Just when I thought I had a grip on C++ … well done, guys. ((slow-clap))
Kinda rethorical question: Do you ever?
@@OperationDarkside 3 years later, I can confidently tell you that you never do.
"Jason" just talked about how we actually represent "Jason" values
I’ve done all of SHA2 in constexpr, and I’ve even written a program that Randomly decides when it wants to compile.
great talk by deane and jason, as always !
a milestone lecture. well done!
wow, this really is constexpr all the things
Great talk by Bean and Freddie, as is the norm.
I don't know whats going on either. I just try to fit in.
"constexpra" tripped me up every time
@Mercer “constant expression” can be any constant expression
“constexpr” is a 'term', which also mean functions, and methods, which evaluate on compile time
"You can clearly see..." -> No I can not, lol
Nonetheless, awesome
That's functional syntax for parsing a string key to the value of your reaction. Nice.
So much usefull knawledge. :D
33:45 Isn't that essentially zipWith in haskell?
Is this the same talk from 2016?
The code on slide 20 (at 12:20) is not part of the github project and doesn't seem to compile.. Nothing of cx_map.h seems to be used in the project. When I comment all its content out and remove its import into cx_json_value.h, the project still compiles?! Whenever I try to use cx::map, it gives an error "no type named 'type' in 'struct std::enable_if'". (Tried with GCC 7.2.0 as they claimed to use - concrete distribution: MinGW-w64 x86_64-7.2.0-release-posix-seh-rt_v5-rev1.)
Did anyone else catch The Prisoner reference at 51:38?
combine is liftA2
Wtf are those comments on every vid ;o
Next stop, Lua constexpr implementation.
bit disappointing to see old Jason video in new clothes. Where I can see the source code of this?
OK, this is just a fun thing to do isn't it (and interesting), but totally impractical. Would be faster/better to write a simple console app to parse json into a C++ structure, running it as a pre-build step.
Nope, this isn't just a fun thing to do, it is extremely useful. As is obvious from the talk constexpr still isn't quite ready for prime-time, but when it is it will be extremely useful. It looks like it is getting close, I am guessing that by C++20 it will dripping with awesomeness.
minimizing the steps and dependencies of your build system is key.
It's very impressive, but honestly? a) You can't debug it properly, really, and thus it's VERY hard to use in an environment with multiple people having to be able to read and understand the code, and b) as soon as your code base grows past a few 100k loc this "bit of compile time overhead" will drive everyone insane (if we assume a relatively constant percentage of constexpr code to runtime code). It's nice to speed up your runtime side, but if every recompile takes (literally!) hours, you can't work on the code base productively anymore.
What in this video leads you to believe that this would substantially increase compile time? I think that Ben and Jason made the point that other than debug builds (which is likely due to symbol emission) that compile time and compile time memory usage are not significantly impacted.
100k LOC doesn't nearly take an hour, though. More like 2.5 minutes for a full recompile (which you should only need very rarely). /DEBUG:FASTLINK will give you much better productivity than reducing code complexity in the interest of compilation time.
It's out of topic but why always guys??
I want to see more women on the stage any more especially in this discipline.
By the way, congrats guys, great talk :)
Why don't you start? Who exactly is stopping you?