C++ Lambdas Part 1 - Unnamed function objects (closures) in C++ | Modern Cpp Series Ep. 100!!!

Поделиться
HTML-код
  • Опубликовано: 13 дек 2024
  • НаукаНаука

Комментарии • 41

  • @Gary-b6b7f
    @Gary-b6b7f 16 дней назад +1

    @7:53 shows that while lambda functions are fundamentally unnamed there is a simple way to effectively assign one.

  • @CPP_malloc
    @CPP_malloc 2 года назад +8

    Mike, you look like a man with good knowledge of Cpp and programming in general, I hope your channel one day get the number of subscriber and viewers it deserves.

    • @MikeShah
      @MikeShah  2 года назад +1

      Cheers, thank you for the kind words! I learn quite a bit by sharing :)

    • @CPP_malloc
      @CPP_malloc 2 года назад +1

      @@MikeShah btw, I saw in your videos, some about OpenGL, as well it seems you have a good base in math when you talked about computational geometry.
      what do you think of starting a series, in building a Raytracing engine, or a simplified game engine?
      how about starting interesting series, like talking about file headers in executable files, and how this can be used in malwares and viruses, as well as talking about some OS APIs, especially windows which can be used in cyber security,....
      I believe these topics will make a huge difference in your channel, like don't always focus on specific topics in CPP standards, but instead of that, start a series on a whole topic in software engineering from a to z.
      this is my advice I may be wrong, but this is what I notice from different channels.

    • @MikeShah
      @MikeShah  2 года назад +1

      @@CPP_malloc All great thoughts -- definitely thinking about some longer form series and documenting some of my own projects :)

  • @Marzex1x
    @Marzex1x 8 месяцев назад +1

    much love man, wish my professors were able to explain things like you do 💜

    • @MikeShah
      @MikeShah  8 месяцев назад +2

      Cheers, thank you for the kind words

  • @xarzu
    @xarzu Год назад +2

    at 10:34 ... I find the C++ compiler interesting. Both print_v and print_functor use n and it receives n as a parameter. Yet the for_each command does not seem to pass any parameter to the lambda or other function.

    • @MikeShah
      @MikeShah  Год назад +1

      That is kind of neat :) en.cppreference.com/w/cpp/algorithm/for_each provides a reference implementation of for_each, and observe the input is a 'UnaryFunction' which takes in exactly one parameter. So no need to pass anything, we are effectively taking in the current element the iterator points to (dereferenced) and that is our function input.

  • @skeleton_craftGaming
    @skeleton_craftGaming 9 месяцев назад +1

    I was literally saying that closures are specifically unnameable functors... (Which is not always technically the case if I understand lambda calculus correctly) B4 you even started saying pop quiz

  • @tbeng12
    @tbeng12 Год назад

    Last two minutes of the video saved my life, thanks man 😅

  • @legendarytwister3656
    @legendarytwister3656 4 месяца назад

    Thank you for your work! You are helping me and all other C++ learners a lot by making those videos! :)
    You motivated me switching to linux and working on vim while I work on my exercises for my portfolio!
    Keep up with the good stuff, kind sir!

    • @MikeShah
      @MikeShah  4 месяца назад

      Cheers, thank you very much for the kind words! Well done joining Linux :)

  • @nagenHARP
    @nagenHARP 9 месяцев назад +1

    Excellent Lessons Bhai

  • @kafuu1
    @kafuu1 Год назад +1

    Awesome video! Learned a lot

    • @MikeShah
      @MikeShah  Год назад

      Awesome! Happy to hear it!

  • @VoidloniXaarii
    @VoidloniXaarii Год назад

    I've got a feeling this might be one of the most important in the whole amazing series. Thank you so very much 🎉❤🙏

  • @aarovprasad391
    @aarovprasad391 Год назад +1

    You teach great, thank you!

    • @MikeShah
      @MikeShah  Год назад

      Cheers, thank you for the kind words!

  • @k0185123
    @k0185123 5 месяцев назад +1

    Nice!!! Brilliant!

  • @AjayKushwaha-vi5vg
    @AjayKushwaha-vi5vg Год назад

    I loved it. thanks Mike, you are superfast.

  • @wika96
    @wika96 2 года назад +1

    You are awesome. Can you do a series on Design patterns soon.

    • @MikeShah
      @MikeShah  2 года назад

      Thank you for the kind words! I have a playlist here which I will be adding to: ruclips.net/p/PLvv0ScY6vfd9wBflF0f6ynlDQuaeKYzyc

  • @robertstrickland9722
    @robertstrickland9722 2 года назад +2

    Mike, do you offer one on one tutoring in C++? I've been through a couple of job interviews recently and always fall just short of success during them. Whether it be via hackerrank sessions, live coding, or knowledge. I wanted to see if maybe you offered a service to help prepare for these things in a more 1-1 manner.

    • @MikeShah
      @MikeShah  2 года назад

      I don't at the time offer 1:1 tutoring, but I'll put you in touch with someone who does.

  • @joebosah2727
    @joebosah2727 2 года назад +1

    Thanks

  • @ARANDOMOPENAIUSER
    @ARANDOMOPENAIUSER Год назад

    3:30

  • @ghulam2545
    @ghulam2545 2 года назад +3

    [](){}; // these are not just braces, but also correct code in c++. hehe

  • @thewelder3538
    @thewelder3538 6 месяцев назад

    I know it's an introduction, but I don't think you did someone watching any favours by capturing an int by reference. If you were capturing the vector, sure [&], but for the int especially with the way you were using it, [=] would have been better.

    • @MikeShah
      @MikeShah  6 месяцев назад

      Good note!

    • @thewelder3538
      @thewelder3538 6 месяцев назад

      @@MikeShah this also leans well into a follow up video when capturing by value and using the rarely used mutable.

    • @MikeShah
      @MikeShah  6 месяцев назад

      @@thewelder3538 Agreed!