Every time I want to pass a shared pointer to a function, it makes sense to pass it by reference. Is there any reason not to? #programming
-
-
Vastauksena käyttäjälle @MachineLinguist
@MachineLinguist the lifetime of the function is less than that of the outer shared pointer. Unless you are multithreading very poorly.1 vastaus 0 uudelleentwiittausta 0 tykkäystä -
Vastauksena käyttäjälle @tloch14
@MachineLinguist so why bother with another add ref and remove ref? Like, if your most outer scope of the shared ptr has a ref, all inner1 vastaus 0 uudelleentwiittausta 0 tykkäystä
@MachineLinguist scopes don't need to add it themselves as well. You're just giving the computer redundant work.
6.26 - 8. huhtik. 2015
0 vastausta
0 uudelleentwiittausta
0 tykkäystä
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.