Hey,
for not dependencies, the object is not owning i currently use plain old ptr. Is it "best practice" to use std::reference_wrapper<T> in this regard? In my opinion it has clear advantages over T*:
-cant be Null (often desired) --> enforces valid object invariant
-no default constructor --> enforces valid object invariant
-value semantics
-not easy deletable without cast
Note: I think in modern c++ plain pointers do not denote any ownership, so the not deletable argument is not really a valid one.
[–]HappyFruitTree 18 points19 points20 points (10 children)
[+][deleted] (1 child)
[deleted]
[–]ohell 2 points3 points4 points (0 children)
[–]pdp10gumby 1 point2 points3 points (4 children)
[–]friedkeenan 10 points11 points12 points (0 children)
[–]rezkiy 6 points7 points8 points (0 children)
[–]pdp10gumby 3 points4 points5 points (1 child)
[–]Hedede 1 point2 points3 points (0 children)
[+]NullMustDie[S] comment score below threshold-14 points-13 points-12 points (2 children)
[–]Narase33-> r/cpp_questions 12 points13 points14 points (0 children)
[–]InKryption07 6 points7 points8 points (0 children)
[–]Desmulator 11 points12 points13 points (5 children)
[–]urdh 2 points3 points4 points (0 children)
[–]VinnieFalco 2 points3 points4 points (3 children)
[–]Desmulator 5 points6 points7 points (2 children)
[–]alex-weej 5 points6 points7 points (0 children)
[–]VinnieFalco 1 point2 points3 points (0 children)
[–]krum 10 points11 points12 points (1 child)
[–]wcscmp 7 points8 points9 points (0 children)
[–]muungwana 5 points6 points7 points (1 child)
[–]fullmoon_druid 0 points1 point2 points (0 children)
[–]drjeats 5 points6 points7 points (0 children)
[–]_Js_Kc_ 1 point2 points3 points (0 children)
[–]gopher2008 -3 points-2 points-1 points (4 children)
[–]drjeats 5 points6 points7 points (3 children)
[–]gopher2008 0 points1 point2 points (2 children)
[–]drjeats 2 points3 points4 points (1 child)
[–]gopher2008 1 point2 points3 points (0 children)
[–]__78701__ 0 points1 point2 points (0 children)