I think writing a global smart pointer std::shared_ptr sp1 = sp would also not be atomic in case the write takes place from multiple threads. The smart pointer class object is subject to tearing. So you need to use atomic_load() (C++11) or atomic shared pointers (C++20).
hy bro excellant explanation....please clear my doubt bro ... why you are using dot operator for use_count instead of arrow operator because my understanding is sp is a pointer so we must use arrow operator to deference anything . thanks cppnuts
Arrow operator is for managed object, and dot operator is for SP class it self. Because we have object of SP so we can use dot operator to access member functions of SP class.
Hi Rupesh, Interviewer Asked me a question What is the actual use of reference count when it will be useful what you will do by knowing the count. where you will use?
Reference count is used to protect your variable from deleting. Meaning if your variable is being referenced somewhere then it should not be deleted so we keep the reference count to find if some where this variable is being used.
Hello. You forgot to mention about that you can use a deleter function then you create a share pointers, and the profit of using a make_shared function.
Thanks a lot, I¡m doing a course form Udemy and here is more clear, thanks a lot. I see the videos have now a lot more of quality... Thanks for your work is really helpfull.
at the end of the video u have added lock guard to the thread function but did not explain, i think its to make the managed object as thread safe? correct me if i am wrong
Next level explaination bro🔥🔥🔥 and next level accent as well😂
Theenkksss
I think writing a global smart pointer std::shared_ptr sp1 = sp would also not be atomic in case the write takes place from multiple threads. The smart pointer class object is subject to tearing. So you need to use atomic_load() (C++11) or atomic shared pointers (C++20).
hy bro excellant explanation....please clear my doubt bro ...
why you are using dot operator for use_count instead of arrow operator because my understanding is sp is a pointer so we must use arrow operator to deference anything . thanks cppnuts
Arrow operator is for managed object, and dot operator is for SP class it self. Because we have object of SP so we can use dot operator to access member functions of SP class.
@@CppNuts thanks a lot brother got it .....
Hi Rupesh,
Interviewer Asked me a question What is the actual use of reference count when it will be useful
what you will do by knowing the count. where you will use?
Reference count is used to protect your variable from deleting. Meaning if your variable is being referenced somewhere then it should not be deleted so we keep the reference count to find if some where this variable is being used.
Exact explanation, thank you so much for your effort, like the term manageable object.
Thanks dude..
Hello. You forgot to mention about that you can use a deleter function then you create a share pointers, and the profit of using a make_shared function.
Thanks a lot, I¡m doing a course form Udemy and here is more clear, thanks a lot. I see the videos have now a lot more of quality... Thanks for your work is really helpfull.
Great to hear!
cleared all concepts. Thanks a lot. please one video on "Lamba expression in details which is introduced in C++ 11"
Will upload soon!! Actually i thought i have already given this video, thanks dude.
Question about 4.b point
why it should detroy managed object if initialzed with some other shared_ptr?
Can you please tell, What is the IDE you use for compilation?
Well explained, thank you.
Thanks man!!
Bro please tell where you studied , this much detailed, i want to read..
Stackoverflow 😂
bro @CppNuts how you told -> is overloaded??. Just Curious:)
at the end of the video u have added lock guard to the thread function but did not explain, i think its to make the managed object as thread safe? correct me if i am wrong
Thanks sir ~Well explained.
Glad it was helpful!
could you please give me a hint on line 25 constructor. i am new to this
In Foo destructor pointer deletion s required r is it taken care by smart pointers,
If so y destructor is called.
Thank u
great video. thank you!
Welcome
Can you make a video on "
" vs endl?
Sure..
I'll have to go 20 seconds back because i was reading comment instead of watching the video 😂
Yes very well explained cleared up some confusion thank you! : D
Glad it was helpful!
Nice explanation, Is there any way to get the program source file ?
Yes please check channel about page.
Is it possible to copy vector data... So that we can pass shared in function
Std::make_shared
I checked with cplusplus, I think the syntax shown in thumbnail of the video is not correct.
Correct..
I will change it thanks man..
In hurry it happens.. 😁
sir we conduct the online classes? give me the replay plz
when are you making videos on deleter / custom deleters ?
It will take time, now i am working on DS.
Please do not use foo bar func as names. This is the reason most people don’t understand the real world usage.
Sure!!
Objaaaact!!!!
Good explanation. But dont have this fake accent while you are presenting something
Kuch cheeze nahi badal sakta hu.. :P
two much ads bro
Sorry dude!!