C++17 - The Best Features - Nicolai Josuttis [ACCU 2018]

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

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

  •  5 ปีที่แล้ว +12

    Every update makes C++ easier & more comfortable. Thanks a lot for your introduction speech!

    • @MN-sc9qs
      @MN-sc9qs 5 ปีที่แล้ว +2

      Getting closer to Python!

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

      Won't the compilation take longer tho?

    • @celticwinter
      @celticwinter 3 ปีที่แล้ว

      @@MN-sc9qs Yes, and Fortran is getting closer to LaTeX. What is this even supposed to mean?

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

    I have not touched C++ since before C++11 (!) and have learned my habits from modern java, python and now rust. Using this video as a springboard so I can quickly learn c++ for an interview...
    It's going to be an intense study, but I think I can try to map the type-safe & memory-safe attributes of rust by adopting these new language features and some type of coding style to recreate ownership principle in C++.

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

    This was super interesting, thank you Nicolai.

  • @yackawaytube
    @yackawaytube 4 ปีที่แล้ว +5

    Morgan Stanley still has the best C++ programmers out there, under Stroustrup's leadership. BTW, he could have easily explained transform_reduce as map-reduce

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

    its beauty...

  • @MohamedAli-nr2dr
    @MohamedAli-nr2dr 5 ปีที่แล้ว +1

    Great job gentleman

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

    I love inline vary abbles.

    • @Schcarraffone
      @Schcarraffone 3 ปีที่แล้ว

      not that fun in st peterburg right??

  • @dillip4572
    @dillip4572 3 ปีที่แล้ว

    aweome, thanks champ :)

    • @ACCUConf
      @ACCUConf  3 ปีที่แล้ว

      Glad you liked it!

  • @michaelchoi8247
    @michaelchoi8247 5 ปีที่แล้ว

    beautiful.

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

    awesomeness

  • @yuehuajia3176
    @yuehuajia3176 6 ปีที่แล้ว

    wonderful

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

    Wow

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

    What happens if you have a static inline variable in a header, used in 2 libraries or a library and an app?

    • @ACCUConf
      @ACCUConf  4 ปีที่แล้ว

      Your comment has been forwarded to the speaker :)

    • @ian3084
      @ian3084 4 ปีที่แล้ว

      @@ACCUConf Oh thank you:)

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

    How can I press like 12 times on this video ?

  • @eduardofernandezdiaz5264
    @eduardofernandezdiaz5264 5 ปีที่แล้ว

    Did this new update to C++ caused any changes to its performance?

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

    no operator new for vector elements.. does it create a variable on the stack or in the heap?

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

      In the heap.
      The vector is still created in the heap but it contains its elements directly, rather than pointers to the elements, so there is no need to call new for each element.

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

    The problem with variant is that when I make a container of base class instances, usually it is either a) derived classes I do not know of or b) other templatized containers. Of course I am not going to forward specify a discrete set of those templatized containers so this variant semantics is 100% useless in my cases. I still have to deal with copy pointer mistakes and use after free issues and variant wont help

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

      Well, he does specify that std::variant is supposed to be used with closed sets. Perhaps not the tool you need, but a good tool nonetheless.

  • @hl2mukkel
    @hl2mukkel 6 ปีที่แล้ว

    Good talk!

  • @shahmiBro1
    @shahmiBro1 5 ปีที่แล้ว

    why don't you use Lisp? and as mentioned by Andrei Alexandrescu in his talk from MeetingCPP, fix the if constexpr for the sake of humanity;

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

    std::variant may have its use, but the argument about replacing normal vtable inheritance is weak.
    std::unique_ptr + std::make_unique or std::shared_ptr + std::make_shared remove the worry of freeing things. Sure, you make allocations, but unless the object is really trivial, you may have others within the object constructors that offset the saving.
    If sizeof(A) >> sizeof(B) in std::variant the size will be the one of the biggest object, within a vector (for an implementation which avoid allocations by using std::variant self storage).
    There is a local vtable generated by the compiler upon std::visit (check with godbolt), and obj->draw(...) is MUCH cleaner than the std::visit dances.
    There might be cases (very small, trivial objects ... or inlined object method calls within std::visit) where std::variant might be useful, but IMHO the argument of standard vtable based inheritance replacement is weak.

  • @evandrix
    @evandrix 6 ปีที่แล้ว

    public link to slide deck?

    • @ACCUConf
      @ACCUConf  6 ปีที่แล้ว

      All slides have been uploaded to the ACCU conference website under the 'sessions' tab.

    • @evandrix
      @evandrix 6 ปีที่แล้ว

      conference.accu.org/2018/sessions.html ? i don't see any links to PDFs...

    • @ACCUConf
      @ACCUConf  6 ปีที่แล้ว

      Sorry my mistake, they are being added to the schedule page: conference.accu.org/2018/schedule.html Not all have been uploaded yet, check back in a couple of days and they should all be there

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

    C++ is too damn difficult

    • @EDANAiRoNY1
      @EDANAiRoNY1 6 ปีที่แล้ว

      no its so easy

    • @Knuckler
      @Knuckler 5 ปีที่แล้ว

      @@EDANAiRoNY1 you didn't gawk at the variant example? You must be a c++ expert.

    • @deanroddey2881
      @deanroddey2881 5 ปีที่แล้ว +5

      @@Knuckler I feel like I'm taking crazy pills when I listen to C++ modernists sometimes. I mean variant is possibly the biggest single reason that OO was invented. Apparently they don't remember this. Variant is nothing but a glorified case statement. And one of the reasons OO was invented was because of exactly that, that you ended up with a bunch of case statements. And every time you add some new functionality, you have to go to every such case statement and figure out, what do I need to do for each of these cases. Unless it's very simple and unless it's a completely internal detail, it's crazy because you know have client code having to make these decisions.
      And, on top of that, he turns around and creates a class hierarchy of functors to get around the fact that he didn't create a class hierarchy to begin with, AND makes it all templatized so that it isn't explicitly typed.
      It's like some sort of bad joke to see if we get it.

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

    How is variant/ visit better than smart pointers?

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

      I would not say better, but using variant allows you to use the stack instead of the heap at the expense of using a compile time fixed set of types

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

      This is faster because it saves 1 indirection and lots of memory for the shared pointers (at least 48 bytes per item on 64bit). Also the class hierarchy gets less dependencies which might be nice or irrelevant.

    • @jomunoz
      @jomunoz 6 ปีที่แล้ว

      In addition to what Lothar said, also in the variant example the elements are faster to transverse since the elements (Circles and Lines) are next to each other.
      In the pointer example, the vector only contains the pointers, the objects they point to can be anywhere in memory.

    • @Evan490BC
      @Evan490BC 5 ปีที่แล้ว

      @@llothar68 I think viewing those in terms of stacks and heaps is a very low-level point of view here. Variants is an attempt at providing sum types in C++. Smart pointers is an attempt at providing ownership semantics (similar to Rust's), a crude version of linear types.

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

      @@Evan490BC Sorry i'm too old for this type esoteric bullshit. I stopped when they started to call simple down casting (to void as an extrem) type erasure. Everything in computers is explained much much better when you go to assembler level and then explain it from there.
      SmartPointers is not ownership, it's reference counting and nothing else. The ownership semantics are just one use case for it. I can put two different reference counters on the same object and provide an invoked when reaching zero that might do something totally different and it would still be legal C++. I think this is the main reason why people today can't program anymore.

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

    Great features! The only problem is it is too late!

    • @mcbernnard4303
      @mcbernnard4303 6 ปีที่แล้ว

      It's better than nothing. C++ is the King of Programming Languages.

    • @eminqasimov3398
      @eminqasimov3398 6 ปีที่แล้ว

      😂😂😂yeah agree, i plan to learn Rust instead of c++ for boost my web projects.

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

    Good list.. good to see C++ catch up with D language.. but still can't beat that

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

      Wrong. Two words: TOOLS and LIBRARIES

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

    c++ is such a mess

    • @NotBroihon
      @NotBroihon 5 ปีที่แล้ว +4

      Just because it goes over your head doesn't mean it's a mess.

    • @gast128
      @gast128 3 ปีที่แล้ว

      Agree. To name a few: std::vector{1} vs std::vector(1); forwarding references; two phase lookup and the iostream library. I still prefer C++ over any other language mainly due to its low overhead.

  • @vectorhacker-r2
    @vectorhacker-r2 6 ปีที่แล้ว +4

    C++ is just playing catchup and adding complexity to the language. So glad languages like Rust and Go are going to replace it soon.

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

      "Soon", meaning in the next 20 to 30 years, right?

    • @Evan490BC
      @Evan490BC 5 ปีที่แล้ว +2

      Not Go. Go targets a different space. Rust, maybe.

    • @joestevenson5568
      @joestevenson5568 5 ปีที่แล้ว +2

      yeah, soon.....

    • @beardninja5029
      @beardninja5029 5 ปีที่แล้ว

      I wouldn't bet on Go but Rust? definitely.

    • @cipherxen2
      @cipherxen2 5 ปีที่แล้ว

      No