CppCon 2016: Stephan T. Lavavej “tuple<>: What's New and How it Works"
ฝัง
- เผยแพร่เมื่อ 26 ส.ค. 2024
- CppCon.org
-
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/cpp...
-
std::tuple<>has been gaining new abilities, like get-by-type in C++14 and conditionally-explicit constructors in C++17. This talk will begin by briefly summarizing what you can do with tuples in C++11 and C++14. Next, we’ll explore what’s new in C++17, and how it can improve your code. We’ll also delve into how this magic is implemented, with new metaprogramming tools like std::conjunction<>. Finally, we’ll look at active issues in tuple’s design, and what the Library Working Group is doing about them.
-
Stephan T. Lavavej
Principal Software Engineer, Microsoft
Stephan T. Lavavej is a Principal Software Engineer at Microsoft, maintaining Visual C++'s implementation of the C++ Standard Library since 2007. He also designed a couple of C++14 features: make_unique and the transparent operator functors. He likes his initials (which people can actually spell) and cats (although he doesn't own any).
-
Videos Filmed & Edited by Bash Films: www.BashFilms.com
*-----*
Register Now For CppCon 2022: cppcon.org/reg...
*-----*
His name is literally Stephan T. Lavavej or STL 😂
Phew! That's some solid piece of magic-fueled machinery right there.
Great talk Stephan, thank you!
Since it is the most important topic of the presentation, Tuple is not pronounced "Two-pull" because of its spelling. In the English language, with all of it's irregularities, it is not prudent to evaluate pronunciation without considering etymology. Before computer scientists adopted the term tuple, mathematicians derived the word from the sequence "single, double, triple, quadruple, quintuple, sextuple, septuple, octuple, ..., n‑tuple". So, unless you say Sept-Too-Pull, you are being hypocritical.
I do say "sep-too-pull", thank you very much. And similarly for all other numbers >=4, they all have a long U.
Both pronounciations are correct. What's definitely incorrect is how he says "query"
C++ the only language where you can write a book about something as simple as a tupel.
You mean the only language that lets you implement (except D maybe) a tuple in the library and still compiles to zero-cost code. For subpar tuples you have other languages, code-generation wise :)
This isn't a good thing though.
C++ has tuples, that only leads to the next problem, where you have to make sure you have enough tuples. You don't want to be trying to create a tuple with nineteen entries, and then find out that the limit on tuples is eighteen. If you've studied FP you know where I'm coming from.
@@germandiagogomez I don't think it is zero-cost. Using tuple sometimes involves function calls (for instance at () ) which you can actually avoid by using Class with named members. tuple brings more complexities than benefits only making the language already complicated enough more confusing.
These can be inlined by the compiler. Whether they are... well... I don't know.
Way above my head
Slide 4 was the BEST! thank you.
53:20 what about a volatile U?
Shouldn’t NotSelf use remove_cv_t?
Wonderful talk.
Just when you thought you knew everything about tuples.
why can't i just use structs?
Haha, I wonder if tuple (tuh pull) stemmed from "tupperware". I have no idea though.
I pronounce quintuple as kwin tuh pull
I feel for anyone who had to write an implementation of this.
Meanwhile I am drowning in __tuple_base_type, __tuple_base_index, and __tuple_base.
tuple:__tuple_base;
__tuple_base:__tuple_base,__tuple_base_index
__tuple_base:__tuple_base_index;
__tuple_base_index:__tuple_base_type.
The reason for the last layer is
get(t) -> static_cast[static_cast(t))
16:19 This man has the audacity to preach on how to pronounce tuple, but then pronounces query as "corey"! The nirve! You don't say "in-cor-er"; it's "inquire"!
He and I have many arguments over how to pronounce words in board games.
Is it tuh-ple? I pronounce like that and don’t give a fuck.
"I kind of view this as over-engineering...", yeah
Not his best presentation with so much information cramped in 1 hour. Perhaps STL can unravel this talk and explain the used template tricks in a Channel 9 video series?
over-engineered is... an understatement to say the least. Sadly you won't get the same elegance from tuples that you would from ie OCaml (or if you're really serious about those zero-cost abstractions, Rust)
ϕPPL had what you are calling "tuples" back before 2011 (first compiler) but syntax is much cleaner and simpler and is better integrated with its typing system as a whole. It was part of the language pretty much from the beginning. But we call the concept "encapsulation" and "decapsulation" which is really more descriptive since they are operations as much as data structures. These C++ add-ons are somewhat awkward and not as coherent. The underscore notation for unused tuple members should have used the key word "void" (already in C) instead of the underscore which is a legal identifier. That was a bad oversight in my opinion.