Back to Basics: Templates (part 1 of 2) - Andreas Fertig - CppCon 2020

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

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

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

    I love the use of C++ Insights, it really helps me understand what templating is doing under the hood without a 5th dimensional brain.

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

    It's funny to see the German word "seit" instead of "since" on slide 4 at 7:46.

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

    1.5x speed is okay to listen

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

    At 30:30 you are just updating the wrong line. The char array declared on line 32 doesn't get it's size used. I think you meant to update the char array declared on line 35.

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

    There are template templates? I need to watch every single video in the series.

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

    I got so much out of the first viewing of this video on this topic that often fills people with consternation. ~45:23 on the second viewing, I now get that due to multiple inheritance being allowed in C++, and, in fact, multiple inheritance of class templates, that you could not just simply call Func() there, as it could be ambiguous. Now that didn't happen in this case, so it would again seem like the compiler could see that and not be fussy, but yes, I see that if Bar multiply inherited Foo, that Func() would be ambiguous. What I don't see then is what this-> would buy us in that case. Wouldn't this->Func() still be ambiguous in the case that we had multiply inherited from Foo and Foo in Bar? Maybe what is going on is that in the first pass this makes the compiler happy enough to not complain, and then when it compiles the instantiation this...no, it still seems to me that in the weird case you described of multiple inheritance of Foo in Bar, that this->Func() would still be ambiguous at that point, so I don't see how it would help us.
    EDIT: on the third listen, it sounds like only Foo::func would help us in the case of multiple inheritance of different Foo specializations.

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

    He says, don't use manual for loops, use range for loops. Sure, I agree, good advice. Then he goes on to use printf instead of cout and doesn't even mention it...

  • @ВадимКлимов-й1щ
    @ВадимКлимов-й1щ 2 ปีที่แล้ว

    I watch the video on 1.5x and it is still extremely slow

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

    You may want to start watching the video at min 8.

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

    Thank you for this nice and easy to understand presentation.
    Just want point out that you have written
    "void Main" everywhere, i guess it is a typing error.

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

      It's not. It's just a regular function not THE main function.

  • @aditya.ishan27
    @aditya.ishan27 4 ปีที่แล้ว

    Thank you so much

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

    I have never heard, that the C++ compiler/linker will accept the "Main()" function as the program entry point.
    C++ Templates are well known to strongly reduce the speed of program execution.

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

      Templates add to compile time overhead, not runtime. If your code is slow, it's probably your design that needs to improve.

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

      I don't believe that's true at all.
      Templates are resolved at compile time.