About RefPtr Cast Avoidance Modification

Hi,
My name is Yukio Murakai (m-yukio).

Commits on Jun 26, 2016 “Improve RefPtr to avoid casting when possible”,
changed the type of _ptr from Ref to a pointer of T,
T is forward declaration (incomplete type),
If called by an inline function defined in a header file, a build error will occur.

The error is the following code:

const_cast<Ref*>(static_cast<const Ref*>(ptr))->release();

static_assert(std::is_base_of<Ref, typename std::remove_const<T>::type>::value, "T must be derived from Ref");

I understand the reason for reducing the cast, but
Since RefPtr is a class that manages instances of Ref, the previous implementation seems to be straightforward.

Since RefPtr class is a class that manages Ref, I think that the former Ref type variable is more straightforward than making it a T type variable of template.

In addition, the following comments have been made in the previous code, but after the change, I think that consideration of forward declaration (incomplete type) is insufficient.

// Note: using reinterpret_cast<> instead of static_cast<> here because it doesn't require type info.
// Since we verify the correct type cast at compile time on construction/assign we don't need to know the type info
// here. Not needing the type info here enables us to use these operations in inline functions in header files when
// the type pointed to by this class is only forward referenced.