79609033

Date: 2025-05-06 15:39:10
Score: 1
Natty:
Report link

The problem is that std::unique_ptr<T> cannot be cast to T*; and, in general, you should not be using C-style casts in C++. Your comment about the GetWidth and GetHeight lines is fair, but this is because of the operator overloading: indeed, this says nothing about the cast-ability of the type; it merely makes it behave like the underlying type pointer with regard to dereferencing. The raw pointer (the memory underlying the unique_ptr) can be obtained through myVec[0].get(), but then I'd ask why you are using smart pointers in the first place.

Reasons:
  • Has code block (-0.5):
  • Single line (0.5):
  • Low reputation (1):
Posted by: user