CppCon 2016: Arthur O'Dwyer “Template Normal Programming (part 1 of 2)”

Поділитися
Вставка
  • Опубліковано 7 лис 2024

КОМЕНТАРІ • 33

  • @leocelente
    @leocelente 3 роки тому +11

    The fact that types "overrule" type deduction is something I wish I had learned the first time I heard about templates

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

    Great presentation and content. I am not a C++ programmer by profession. But I learned so much from this. Thanks a lot.

  • @RedRumIzzy
    @RedRumIzzy 8 років тому +10

    Great material and brilliant presenter! Really enjoyed the talk.

  • @YuTe3712
    @YuTe3712 8 років тому +1

    Oh wow, thank you for fixing the title (bottom right)! Wasn't expecting a reupload and got excited thinking it was part 2. :')

  • @AtomkeySinclair
    @AtomkeySinclair 3 роки тому +1

    Worth it for PRETTY_FUNCTION explanation. Neato.

  • @lisekSL
    @lisekSL 2 роки тому

    51:30 UPDATE: c++17 standard added class template deduction types. I've checked, it works. Enjoy folks ;)

  • @IllumTheMessage
    @IllumTheMessage 8 років тому +1

    Nice description of why templates are useful. Thanks for the talk.

  • @Knuckler
    @Knuckler 6 років тому +11

    34:21 "I'm going to assume some knowledge of lvalues and rvalues... it's been five years, people." This speaks to the ridiculousness of Rvalue References and move operations than anything else.

    • @IllIlIIllIlIl
      @IllIlIIllIlIl 6 років тому +2

      I don't see what makes rvalue refs ridiculous. People haven't learned it yet because it is a (somewhat) complicated subject and a lot of people think they don't really need to understand it, which is not true since if you're programming in C++ you obviously care about performance which move semantics is all about, as well as allowing flexibility when copy constructors are deleted, for example.

    • @isodoubIet
      @isodoubIet 5 років тому +3

      @@IllIlIIllIlIl Value categories aren't ridiculous. What's ridiculous is that said categories have to be defined on a case by case basis, so that either you get some imprecise intuition that's "good enough" for most cases (as the vast majority does), or you memorize all the rules, in which case I would encourage you to stay away from sharp objects because you're utterly mad. Surely this is just the kind of situation that merits the adjective "ridiculous". I'm not saying I have a better solution, but the language really is too complicated for its own good in this area.

  • @playerguy2
    @playerguy2 3 роки тому +1

    1:07 ..wait, that's good, right?
    We write templates, sometimes for performance reasons.
    If not much time is spent doing meaningful work, then the this goal has been achieved.

  • @wpavada3247
    @wpavada3247 7 років тому +2

    This would be much more interesting if pointer parameters to the function would be type deducted as well. In that case parameter passed can be both const type or const pointer.

  • @dans.5418
    @dans.5418 6 років тому +4

    Not only a good content but an excellent presentation too. Thanks!

  • @seditt5146
    @seditt5146 5 років тому +2

    Is someone able to explain the is_void to me. I must have missed something because I do not understand how making T void has any bearing on the output here.

    • @ricardorey2714
      @ricardorey2714 5 років тому +2

      Consider this:
      template
      bool is_void = std::is_same::value;
      int main() {
      std::cout

  • @DevinSamarin
    @DevinSamarin 7 років тому +4

    Part 2: ua-cam.com/video/VIz6xBvwYd8/v-deo.html

  • @allopeth
    @allopeth 5 років тому +3

    Arthur you are f.... awesome!!!!!

  • @TarunSingh-je9my
    @TarunSingh-je9my 5 років тому

    Nice explanation.I have below doubt on iterator Why we need to provide specialization in iterator
    template
    void process(Iterator begin, Iterator end)
    {
    for (; itr != end; ++itr) {
    process(*itr);
    }
    }
    why i can't write
    void process(Iterator begin, Iterator end)
    {
    for (; itr != end; ++itr) {
    process(*itr);
    }
    }
    please explain

    • @yotty97
      @yotty97 5 років тому

      Tarun Singh Iterator isn't a recognized type by itself, and there are different kinds of iterators based on type, so if yo wanted to specify a type there (without templates) you would be limiting the function to working on only one kind of interator

  • @Slicc12345
    @Slicc12345 8 років тому +2

    Where can i find the second Part :/?

    • @dresnyd
      @dresnyd 7 років тому +2

      Should be in the right (PC) list as recommended videos that people watched after this. Among the first videos. Probably was too recently uploaded for YT to realize that at the time you watched this video.

    • @andersknatten
      @andersknatten 6 років тому +7

      ua-cam.com/video/VIz6xBvwYd8/v-deo.html

  • @YasasCPerera
    @YasasCPerera 5 років тому

    awesome talk. and whoever contributes to the subtitle, a great job.

  • @notalexmarin
    @notalexmarin 6 років тому +1

    love the guy

  • @victornoagbodji
    @victornoagbodji 8 років тому +3

    where is part 2?

    • @andersknatten
      @andersknatten 6 років тому +3

      ua-cam.com/video/VIz6xBvwYd8/v-deo.html

  • @michaelkohlhaas4427
    @michaelkohlhaas4427 6 років тому

    *That what awesome!!!*

  • @sivabudh
    @sivabudh 8 років тому

    Can we now put template implementations in source as opposed to header files now?

    • @nlguillemot
      @nlguillemot 8 років тому +2

      Yes. Look up extern templates.

    • @llothar68
      @llothar68 6 років тому +1

      Are extern templates currently implemented in any compiler correctly?

    • @Quuxplusone
      @Quuxplusone 5 років тому

      _Extern_ templates have been implemented correctly by everyone for decades now. This is covered in Part 2 of the talk: ua-cam.com/video/VIz6xBvwYd8/v-deo.htmlm44s
      But this is not to be confused with "export templates." _Export_ templates were part of the C++98 paper standard, never got implemented, and were removed even from the paper standard in C++11.
      However, the short answer to Sivabudh's question is "No." I'm surprised that Nicolas said "Yes." Even if "Yes, extern templates" is _technically_ correct (see Part 2), it's not really what people usually mean when they complain about having to put their templates in header files. Extern templates are a niche solution to a niche problem.

  • @che8488
    @che8488 7 років тому

    👍🏻👍🏻👍🏻👍🏻👍🏻👍🏻