Back to Basics: Understanding Value Categories - Ben Saks - CppCon 2019

Sdílet
Vložit
  • čas přidán 27. 05. 2024
  • CppCon.org
    Discussion & Comments: / cpp
    Presentation Materials: github.com/CppCon/CppCon2019
    -
    Back to Basics: Understanding Value Categories
    You may be familiar with the terms lvalue, rvalue, and xvalue, if only because they occasionally appear in compiler error messages. However, if you have only a vague understanding of what they mean, you're not alone. Lvalues, rvalues, and xvalues aren't actually language features, but rather semantic properties of expressions and sub-expressions. Understanding these properties provides valuable insights into the behavior of built-in operators, the code generated to execute those operators, and the meaning of some otherwise cryptic compiler error messages. Understanding these properties is also essential for working effectively with lvalue and rvalue reference types, as well as overloaded operators.
    This session explains why the language distinguishes among lvalues, rvalues, and xvalues. It describes how the semantic properties of lvalues, rvalues, and xvalues are different and how those properties are reflected in the behavior of lvalue and rvalue references.
    -
    Ben Saks
    -
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    *-----*
    Register Now For CppCon 2022: cppcon.org/registration/
    *-----*
  • Věda a technologie

Komentáře • 51

  • @lsmgeb89
    @lsmgeb89 Před 3 lety +38

    After I have been reading some other materials about value categories, this lecture really helps me to understand them.
    Ben explained these concepts in a crystal clear way.
    Every modern C++ books should have this chapter.

    • @me5ng3
      @me5ng3 Před rokem

      What materials were you reading about value categories? I'd love to read more on the subject

  • @pmcgee003
    @pmcgee003 Před 4 lety +35

    TFW your Basics lecture includes the term Temporary Materialisation Conversion.

  • @Possseidon
    @Possseidon Před 3 lety +14

    Ahhh! I knew what lvalue and rvalue where, but never got my head around glvalue, prvalues and xvalues. Now I finally got it! Absolutely great talk!

  • @jiaweihe1244
    @jiaweihe1244 Před 11 měsíci +3

    I cannot find the slides file in the github link provided, is there any other place to get the slides?

  • @collapsingspace
    @collapsingspace Před 3 lety +5

    48:14 For people wondering if std::move(T &&a) has rvalue reference to T as parameter how does it work with something like std::move(str) because str is here an lvalue and it's clearly told in the talk that references to rvalue types only bind to rvalues and not lvalues..
    There's a deeper concept at play here note that std::move is templatized and the T&& a parameter actually becomes T&a when called like std::move(str)... you can find videos on type deduction on youtube.

  • @orlandoboffill7448
    @orlandoboffill7448 Před 4 lety +12

    Mr Ben Saks is a gifted teacher!

  • @pawanadhikari110
    @pawanadhikari110 Před 4 lety +6

    The presentation content isn't available in the github .

  • @kamilziemian995
    @kamilziemian995 Před rokem

    Saks family is an family of experts in explaining C++ in a clear way.

  • @YourCRTube
    @YourCRTube Před 4 lety +7

    Great talk. Both approachable and exhaustive.

  • @dickpiano1802
    @dickpiano1802 Před rokem +3

    When people, who want to make things more complex, so others will be in awe get together you get the C++ universe.

  • @mikkqu
    @mikkqu Před 3 lety +7

    This guy is awesome, I hope to see more of him in the future!

  • @TernaryHound
    @TernaryHound Před 3 měsíci

    Great lecture. I have used these types and move semantics for years and yet this gave me such a more comfortable understanding of the motivations behind these concepts. Well done!

  • @syedimadhaqqi4340
    @syedimadhaqqi4340 Před 6 měsíci +2

    I cannot find the presentation material. Can you please advise a direct link. Thanks

  • @DominoPivot
    @DominoPivot Před 2 lety +1

    I've been working on highly abstract languages for years so that was an excellent refresher.

  • @gustafbstrom
    @gustafbstrom Před 7 měsíci

    This talk made how to think about C++ value catogories so much more clear to me. Thanks sir!

  • @saeedmahmoodi7211
    @saeedmahmoodi7211 Před 4 lety +3

    after 2 months of consusions
    i finally got it
    Geart job!

  • @kamilziemian995
    @kamilziemian995 Před rokem

    I should watch all Ben Saks talks avaliable online.

  • @RyutlisWang
    @RyutlisWang Před rokem

    Thank you Ben for such clear and thorough explanation of value categories, the best I have seen.

  • @kamilziemian995
    @kamilziemian995 Před rokem

    Every C++ programmer should watch this video. With exception to Ben Saks and other superprogrammers that already know it content. 😉

  • @toolmanp3885
    @toolmanp3885 Před 9 měsíci

    This lecture is truly insightful and easy to follow after I tries to study the value categories in cpp references. Huge thanks!

  • @JasonMelton1
    @JasonMelton1 Před 2 lety +1

    Very helpful in untangling these concepts!

  • @SirToxe
    @SirToxe Před 3 lety +1

    Excellent talk by Ben.

  • @bboysil
    @bboysil Před 2 lety

    Perfect introduction to value categories.

  • @ra1n_
    @ra1n_ Před rokem +1

    1 hour just flew by
    Whatta teacher !

  • @RahulRahul-pi5fm
    @RahulRahul-pi5fm Před 8 měsíci

    Thank you Ben for the presentation.

  • @tourdesource
    @tourdesource Před rokem

    Clear as water now, thank you Ben!

  • @unclechaelsneckvein
    @unclechaelsneckvein Před 6 měsíci

    Exceptionally good presentation.

  • @marketqueue8562
    @marketqueue8562 Před 4 lety

    Thanks.... Cleared all my confusion...

  • @guykeren9666
    @guykeren9666 Před 10 měsíci

    Gifted! great talk, Helps to understand the basics (how much I didn't know)

  • @shoulderstack5527
    @shoulderstack5527 Před 9 měsíci +4

    I didn't know std::thread had the ++ operator.
    If C++ didn't exist, and someone said they had a great idea for a language, and described C++ as it is today, no one would take it seriously.
    This is no criticism of the speaker, who has done a great job.

  • @zehaia
    @zehaia Před rokem

    Best explanation of this subject out there.

  • @qasimijaz1664
    @qasimijaz1664 Před 8 měsíci

    what a great talk, thanks Ben

  • @konradkomisarczyk396
    @konradkomisarczyk396 Před rokem

    Loved the talk

  • @Skotopes666
    @Skotopes666 Před 10 měsíci

    Great talk. Very helpful

  • @anatheistsopinion9974
    @anatheistsopinion9974 Před 3 lety

    Beyond excellent!

  • @manuvaad
    @manuvaad Před rokem +1

    Great talk!

  • @hanzheng173
    @hanzheng173 Před 4 lety

    very helpful, thanks.

  • @aftostok6080
    @aftostok6080 Před 7 měsíci +1

    This is great.

  • @paulozhang9346
    @paulozhang9346 Před 2 lety +2

    Amazing, thanks man.

    • @CppCon
      @CppCon  Před 2 lety +2

      Glad you liked it!

  • @janpapaj4373
    @janpapaj4373 Před rokem +1

    Superb lecture!

    • @CppCon
      @CppCon  Před rokem

      Glad it was helpful!

  • @Sabinagirl164
    @Sabinagirl164 Před 4 lety

    Great talk

  • @NonTwinBrothers
    @NonTwinBrothers Před 3 měsíci

    48:45 Alright I'll admit. Intentional or not, that one made me laugh

  • @liveonphoenix5045
    @liveonphoenix5045 Před 2 lety

    @43:08, I don't understand the 'move' assignment overloaded operator that accepts 'rval' or 'temp-val', it is said that it will delete both previous 'lval' that became 'rval' or 'temp-val', whereupon both 's2' and 's3' become 'nullptr'? By moving, do they also mean emptying those two objects?

    • @liveonphoenix5045
      @liveonphoenix5045 Před 2 lety

      Oh, I see, only use move semantic if we know the `src` is no longer required. As a reminder, never miss an excellent talk/seminar/lecture, Keep watching until the end.

  • @nguyendaison27
    @nguyendaison27 Před 2 lety

    Thank you.

  • @abdelrhmanahmed1378
    @abdelrhmanahmed1378 Před 3 lety

    int x = 6;
    int z = 10;
    int& p =x;
    p = 100;
    cout

    • @D0Samp
      @D0Samp Před 2 lety +3

      Because the target of a reference is defined at assignment and does not change afterwards. "p = z" does not change the reference from x to z, it just assigns the value of z similar to "p = 100". The pointer equivalent looks like this:
      int * const p = &x;
      *p = 100;
      *p = z; // "p = &z" does not work, since the pointer address is const
      *p = 200;