Shared Pointers Implementation-MUST know! Advanced C++ Topics for Interviews!

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

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

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

    Ref count should be atomic. Shared_ptr is only useful in multithreaded environment. You would just use a unique_ptr otherwise.

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

    No where on the internet you will find such content. Pure gold.

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

    25:11 -> here we should wrap the logic of move constructor by if(this != ptr) because what if the user trying to self move(like moving ptr1 to ptr1)

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

    One thing, you should rename decrementcounter() method as it just does not decrement the counter, it deletes the resources as well.

  • @colemontmarc
    @colemontmarc 11 วันที่ผ่านมา

    Good explanantion on video, as the comments in the code explain a lot. But please invest in a mic as the audio is really bad.

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

    Thank you soo much guys this is been really really awesome to learn

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

    Hello Keerti
    I hope you are doing good and having productive week
    I have one query
    suppose I create a integer on Heap(int *p = new int(5)) and pass its address to sharedpointer (sharedpointer spr1(p)
    and create another sharedpointer(sharedpointer spr2(p))
    and now suppose if spr1 goes out of scope before spr2 what will this result in?

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

    Very well explained :) , To my knowledge there is no need for nullptr check before deleting, delete internally checks it.

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

      i dont think delete checks for nullptr

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

      @@abhinavjha1973 deleting null pointer has no effect, you can correct me if I am wrong :)

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

    Very good explanation of counter Amit ! Keep up the good work.

  • @FireHarmony-dl2bk
    @FireHarmony-dl2bk ปีที่แล้ว

    great video, please do weak pointer implementation video next.

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

    This type of video series are amazing, got to learn a lot

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

    Well for everyone’s awareness… shared pointer to mutable object is as good as mutable globals. So as general guideline avoid shared pointers as much as you can.

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

    Great explanation

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

    Cool! more c++ please and a better mic too.

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

    In copy assignment, is there a memory leak when you are doing res=ptr_res. how will we delete the memory previously pointed by res.

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

      decrement_counter() function handles that

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

    Hey Keerti, Please bring more C++ Mock Interview videos. And please also cover topics from Basic C++ to Modern C++(At least till C++17)...
    POV : These videos may not have more views now but Mark My words, Your these types of videos will gain more views in long time. Please keep on giving such contents..
    Please add more videos to C++ Playlist where you can talk about all Modern C++ thing and add Mock Interview of C++ there..! These will be very much Useful..
    Thank You..!

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

    Best Understanding

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

    Those two operators are called "move constructor" and " move assignment operator". There are no such things as "move copy constructor" and "move copy assignment operator".

  • @Truysジャ
    @Truysジャ ปีที่แล้ว

    Ma'am pls can you share information about opportunities for c++ developers in IT field.
    Because I rarely see any companies hiring for c++ developers.

    • @AshaRASHA-sv7nq
      @AshaRASHA-sv7nq 5 หลายเดือนก่อน

      All automotive industry use c++, c++ developers are less and more demanding in automotive industry

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

    Hi ma'am same video on Java will be appreciated 💯☝️

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

    where is this even used ??

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

      If you are a C++ developer, it is one of the most important concepts - in daily work as well as in interviews!

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

      @@KeertiPurswani please recommend some projects I can work on to improve my c++ skills i.e. shared pointers...
      I have only worked with c++ stl so far for cp

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

      @@coder7078 make Some game development projects.. you will love using shared pointers,as you have to be very careful with memory allocated for your game objects

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

    mam send link of part 1 video

  • @rahulrajput-ec1to
    @rahulrajput-ec1to ปีที่แล้ว

    👌 cool

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

    wah sab jante hue bhi kya samjhne ki acting ki hai😀

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

    Ex-boyfriend😂😂😂. grt jok

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

    Is he Bihari ??? You really deserved better

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

      What do you have against Biharis? 😅
      I deserved someone who loves me and I got that ❤️✌🏻

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

      @@KeertiPurswani nothing against biharis....
      two sentences were independent.