C++ Type Erasure Demystified - Fedor G Pikus - C++Now 2024

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

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

  • @dimitrioskantakouzinos8590
    @dimitrioskantakouzinos8590 5 หลายเดือนก่อน +18

    Always love talks by Fedor Pikus.

  • @GeorgeTsiros
    @GeorgeTsiros 5 หลายเดือนก่อน +7

    Fedor! Good to see him still do presentations.

  • @pancio-ciancio
    @pancio-ciancio 3 หลายเดือนก่อน

    Wow thanks. Need to rewatch it because is a complex topic for me. I recognize the work behind the presentation.

  • @quicklilac
    @quicklilac 5 หลายเดือนก่อน +1

    19:15 this is not the only thing. I would say another big thing is that std::sort is actually faster than qsort (which is a big deal), and this is thanks to compilers being able to inline comparison.
    UPD: Great talk!

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

      But if the comparison is not simple int/float comparison it is not. But creates more code, lot more code

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

    There is a Bug in slide 37. If
    void operator(void* ptr) {d_(static_cast(p))} is done then with
    smartptr_te widgetPtr = smartptr_re(new widget(), [](auto p){ delete p; })
    above "widgetPtr" will be called for d_(static_cast(p)) which is not correct.
    Real type erasure is deleter function with whatever param as such will be templated and stored internally at COMPILE time. No lazy cast while invoking the deleter. IMO.
    GCC have a test
    static_assert(__is_invocable::value, "deleter expression d(p) is well-formed");
    _Yp is of type widget and not Void.

  • @leanidchaika
    @leanidchaika 5 หลายเดือนก่อน +1

    Nice!

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

      Thanks!

  • @CanIHaveSomeMore
    @CanIHaveSomeMore 5 หลายเดือนก่อน +2

    So Type Erasure is just passing function pointers?

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

    std::function is really great but I wish it had proper allocator support 😢

  • @Roibarkan
    @Roibarkan 7 หลายเดือนก่อน +2

    1:17:29 Eduardo Madrid on thecppzoo: th-cam.com/video/s082Qmd_nHs/w-d-xo.html

  • @rocknroooollllll
    @rocknroooollllll 26 วันที่ผ่านมา

    Usual crowd of know-it-alls with unwelcome contributions -- clearly unsettling Fedor. I do wish they wouldn't. It may be collegial but its bad for posterity on the videos! Perhaps the comments should be edited out? I do like Fedor's talks though. Excellent exposition.

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

    Type Eraser video with different title. Same video uploaded..

  • @josephlunderville3195
    @josephlunderville3195 5 หลายเดือนก่อน +1

    It's PIMPL!

    • @Roibarkan
      @Roibarkan 5 หลายเดือนก่อน +2

      @@josephlunderville3195 Indeed that structure looks very much like the pimpl idiom, but the concept is different. In pimpl the idea is to hide implementation details but all implementations are the same (pointer is used to decouple the single class implementation from the various users), and type erasure is meant to support many implementations (sharing an interface) - even ones unknown to the original designer of the interface.

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

      @@Roibarkan There are multiple use cases for pimpl. including switching the implementation (class type) at runtime which you can't do with C++. I tried to switch vtable pointers once, but while working, code review team got heart attacks. Pimpl just means redirecting function calls