Effective Ranges: A Tutorial for Using C++2x Ranges - Jeff Garland - CppCon 2023

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ธ.ค. 2024

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

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

    Thank you so much for this rather mind-blow/opening talk. The future feels intimidating, even discouraging to my little knowledge, and yet so full of awesome promise and gut feeling tells me this stuff might be huge as c++ reinvents itself

  • @もりけんいち-h4z
    @もりけんいち-h4z ปีที่แล้ว +2

    C++3x+1 point plus linear algebra. Thank you cppcon.

  • @TheDoomista
    @TheDoomista ปีที่แล้ว +15

    I was very confused why half of these examples don't work, then I went to linked godbolt example and realized much of the functionality described in this talk is only available in rangesv3 and not in the standard. Pity.

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

      For instance, the range_v3 join(delimeter) turns out to be join_with(delimeter) in the std library.

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

    Very useful, thanks!

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

    Ufff thank you so much :D

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

    What always boggled my mind is that cpp folks call callable object a functor which is obviously not a functor. And now when they introduced concept similar to what functor actually is, they called it projection. Why?

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

      Probably because it has been that way for the past 30 years. Old habit dies hard I guess.

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

      "Callable" has been in the C++ standard for a while. As a specific concept it's in C++20 as std::invocable.
      Projections are very specifically not just any callable, they are unary callables that return a value.

    • @eugnsp
      @eugnsp 10 หลายเดือนก่อน +1

      Because in the most typical use case demonstrated in the presentation this is exactly how maths calls it.

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

    cool

  • @ABaumstumpf
    @ABaumstumpf 8 หลายเดือนก่อน +1

    That views cache is yet another red flag: Something is seriously wrong with just how much damage the committee is doing to the language.
    Also claiming the talk to be about std::ranges and then using rangev3 (which was objectively more mature and superior)... that is just wrong.
    The example at 40:00 - rv::join(string_view(" -- "))
    That is NOT valid code when using std::ranges.

    • @__Brandon__
      @__Brandon__ 23 วันที่ผ่านมา +2

      Isn't ranges v3 planned to make it in the standard? Why wouldn't he talk about it. It will be helpful for the people watching in 2045. We are lucky enough to get it early

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

    I love C++ for sentimental reasons, the 3rd programming language that I started teaching myself when I was a boy, in the days of MS-DOS. But if it takes one hour to explain ranges... I don't know if I really want to learn these too.

    • @northwestfellow6416
      @northwestfellow6416 9 หลายเดือนก่อน

      It takes a little bit more than one hour, it is just a brief video ^_^

    • @ABaumstumpf
      @ABaumstumpf 8 หลายเดือนก่อน +4

      Why?
      as if 1-2 hours is a lot.... if you are too lazy for even that then i would assume you do not know how to program in any language to begin with.

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

      Well, you could slowly learn about them using C++ ref and watch this video bit by bit.

  • @eugnsp
    @eugnsp 10 หลายเดือนก่อน +1

    Inability to pass views by const-ref is ridiculous.

  • @peregrin71
    @peregrin71 4 หลายเดือนก่อน +2

    I use "rng" because it is shorter and more obvious... ehr no... it makes your code "non standard" just stick with `std::ranges::` (typing less is not a primary goal)

    • @WilhelmDrake
      @WilhelmDrake 12 วันที่ผ่านมา

      What are you talking about. Namespace aliases are completely standard.