• 0 Posts
  • 7 Comments
Joined 10 months ago
cake
Cake day: January 15th, 2024

help-circle

  • Denying entry for people in need can’t be the answer. Honestly, it’s unfair that we were lucky enough to be born into a stable country. It’s unfair that other people have to live under dictators looking only for their personal interest. It’s unfair that people have to live under the consequences of global power struggles and it’s also unfair that Western countries exploit other nations and then don’t lend assistance when everything turns to shit.

    How can you justify sending away these people that are fleeing from warzones or due to global warming. They are losing family and their homes and yet, they spent their life worrying while we can go to restaurants, cafes, play in parks, go hiking, swimming or biking without ever having to worry.

    Leaning into the immigration policy of the right cannot be the answer, there has to be another solution.




  • AngryPancake@sh.itjust.workstoProgrammer Humor@programming.devC++
    link
    fedilink
    arrow-up
    27
    arrow-down
    1
    ·
    5 months ago

    Given that you probably are using pointers, and occasionally you are allocating memory, smart pointers handle deallocation for you. And yes, you can do it yourself but it is prone to errors and maybe sometimes you forget a case and memory doesn’t get deallocated and suddenly there is a leak in the program.

    When you’re there, shared_ptr is used when you want to store the pointer in multiple locations, unique_ptr when you only want to have one instance of the pointer (you can move it around though).

    Smart pointers are really really nice, I do recommend getting used to them (and all other features from c++11 forward).