bool PointerInfo::is_castable_to(const TypeInfo& type) const { // Make sure the given type is a pointer type if (type.GetType().Extends<PointerInfo>()) { const PointerInfo& pointerType = static_cast<const PointerInfo&>(type); // If this type is a const pointer and the other is not, these are not compatible if (IsConst() && !pointerType.IsConst()) { return false; } // If the pointed types are compatible, then we're good to go return GetPointedType().is_castable_to(pointerType.GetPointedType()); } else { return false; } }