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...
    *-----*

ความคิดเห็น • 28

  • @KaranLobana
    @KaranLobana 7 ปีที่แล้ว +48

    His name is literally Stephan T. Lavavej or STL 😂

  • @TomaszWota
    @TomaszWota 7 ปีที่แล้ว +4

    Phew! That's some solid piece of magic-fueled machinery right there.

  • @tomkirbygreen
    @tomkirbygreen 8 ปีที่แล้ว +8

    Great talk Stephan, thank you!

  • @m_a_s6069
    @m_a_s6069 6 ปีที่แล้ว +10

    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.

    • @killerbee.13
      @killerbee.13 6 ปีที่แล้ว

      I do say "sep-too-pull", thank you very much. And similarly for all other numbers >=4, they all have a long U.

    • @TheMrKeksLp
      @TheMrKeksLp 4 ปีที่แล้ว

      Both pronounciations are correct. What's definitely incorrect is how he says "query"

  • @llothar68
    @llothar68 8 ปีที่แล้ว +24

    C++ the only language where you can write a book about something as simple as a tupel.

    • @germandiagogomez
      @germandiagogomez 8 ปีที่แล้ว +61

      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 :)

    • @relaurent1
      @relaurent1 6 ปีที่แล้ว +1

      This isn't a good thing though.

    • @jjames1977
      @jjames1977 5 ปีที่แล้ว +1

      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.

    • @foxchen8144
      @foxchen8144 4 ปีที่แล้ว +2

      @@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.

    • @jovanrakocevic8263
      @jovanrakocevic8263 2 ปีที่แล้ว +1

      These can be inlined by the compiler. Whether they are... well... I don't know.

  • @DimitrisAndreou
    @DimitrisAndreou 6 ปีที่แล้ว +3

    Way above my head

  • @TheDburchill
    @TheDburchill ปีที่แล้ว

    Slide 4 was the BEST! thank you.

  • @ultradude5410
    @ultradude5410 6 หลายเดือนก่อน

    53:20 what about a volatile U?
    Shouldn’t NotSelf use remove_cv_t?

  • @PamirTea
    @PamirTea 3 ปีที่แล้ว +1

    Wonderful talk.

  • @wesofx8148
    @wesofx8148 7 ปีที่แล้ว +5

    Just when you thought you knew everything about tuples.

  • @anthonyrocha8075
    @anthonyrocha8075 3 ปีที่แล้ว

    why can't i just use structs?

  • @cosmicallyderived
    @cosmicallyderived 7 ปีที่แล้ว

    Haha, I wonder if tuple (tuh pull) stemmed from "tupperware". I have no idea though.

    • @friedkeenan
      @friedkeenan 2 ปีที่แล้ว

      I pronounce quintuple as kwin tuh pull

  • @connorhorman
    @connorhorman 5 ปีที่แล้ว

    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))

  • @psudobuddha
    @psudobuddha 7 ปีที่แล้ว +17

    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"!

    • @okaminess
      @okaminess 6 ปีที่แล้ว +1

      He and I have many arguments over how to pronounce words in board games.

    •  5 ปีที่แล้ว +1

      Is it tuh-ple? I pronounce like that and don’t give a fuck.

  • @JamesRoth
    @JamesRoth 5 ปีที่แล้ว +1

    "I kind of view this as over-engineering...", yeah

  • @gast128
    @gast128 7 ปีที่แล้ว +1

    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?

  • @gianni50725
    @gianni50725 2 ปีที่แล้ว +1

    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)

  • @Tapajara
    @Tapajara 2 ปีที่แล้ว

    ϕ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.