Hi, I’m curious about the use of TObjectPtr in two regards:
- What is the appropriate conversion of
const MyClass* const = value;? - Does is make sense to pass a TObjectPtr with
const TObjectPtr<MyClass> &or is this redundant?
My understanding toward each question is:
(1) that the correct conversion would be: const TObjectPtr<const MyClass> which is very different from the use of TObjectPtr as a “drop-in replacement for raw pointer member properties” [ref]. In the latter case a drop-in replacement of (1) could easily be accidently typed as const TObjectPtr<MyClass> const which isn’t valid.
(2) TObjectPtr is a struct so really should be passed with const &, unless there’s some syntax trickery happening.