C++ From Scratch: std::move

Поділитися
Вставка
  • Опубліковано 18 жов 2024
  • In this video we learn about the basics of std::move and move semantics in C++!
    C++ Reference move constructors: en.cppreferenc...
    C++ Reference value categories: en.cppreferenc...
    C++ Reference std::move: en.cppreferenc...
    For code samples: github.com/coff...
    For live content: / coffeebeforearch

КОМЕНТАРІ • 13

  • @simonadams5626
    @simonadams5626 3 місяці тому

    Thank you! A very clear, concise and jargon-free explanation.

  • @anon_y_mousse
    @anon_y_mousse Рік тому +5

    I don't know if anyone else would agree, but I think if they had better defined some of the rules they could've avoided even needing std::move. A lot of both C and C++ strikes me as being weakly thought out. Almost as if the standards committees either had no real world experience or forgot whatever they did have. Not that I'm saying there's a perfect language, and in fact C and C++ are both still the best languages to use for general purposes. But that particular aspect I dislike vehemently and it seems as if a few more recent languages have copied it. Anyhow, that's just my own personal musing, feel free to disagree.

    • @CoffeeBeforeArch
      @CoffeeBeforeArch  Рік тому +4

      I'd say just the fact that move semantics is still so widely misunderstood would indicate that there is a problem with the standard. I think destructive moves are an interesting and intuitive alternative, but haven't honestly given it too much thought.
      Cheers,
      --Nick

    • @filipj4377
      @filipj4377 Рік тому

      Can you be more specific? You're super welcome to suggest a better design instead of saying it's bad in general

    • @anon_y_mousse
      @anon_y_mousse Рік тому

      @@filipj4377 I doubt anyone from the committee would take any of my suggestions, and they aren't likely to see any of these posts, but Nick offered up one possible change that would be better. However, this is one case where I'd actually suggest extra syntax. Even something as simple as

    • @yoavmor9002
      @yoavmor9002 6 місяців тому

      @@anon_y_mousse Isn't

    • @anon_y_mousse
      @anon_y_mousse 6 місяців тому

      @@yoavmor9002 You're right. What I was thinking of wouldn't work in standard C++ because statements that are bare comparisons aren't treated differently to their usage in conditionals. Even something like `int foo = 0, bar = 0; foo

  • @rexseppe7084
    @rexseppe7084 Рік тому +2

    Thanks for explaining!

  • @toxic_champ
    @toxic_champ 3 місяці тому

    stood move LMAO XDD

  • @travelan
    @travelan Рік тому +1

    I couldn't get through the video because 'std' does not stand for 'stud'. Either say S-T-D or 'standard'...

    • @8Trails50
      @8Trails50 Рік тому +20

      pretty lame reason to not get through the video

    • @toxic_champ
      @toxic_champ 3 місяці тому

      @@8Trails50 no, its not