Fixed cast functions on BorrowedPtr being invalid.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
90bda57d79
commit
0b740ee24d
|
@ -33,12 +33,12 @@ namespace ArbUt {
|
||||||
[[nodiscard]] inline constexpr bool IsNull() const noexcept { return _raw == nullptr; }
|
[[nodiscard]] inline constexpr bool IsNull() const noexcept { return _raw == nullptr; }
|
||||||
|
|
||||||
template <class TCast> inline BorrowedPtr<TCast> As() const {
|
template <class TCast> inline BorrowedPtr<TCast> As() const {
|
||||||
auto cast = dynamic_cast<TCast>(_raw);
|
auto cast = dynamic_cast<TCast*>(_raw);
|
||||||
return BorrowedPtr<TCast>(cast);
|
return BorrowedPtr<TCast>(cast);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TCast> inline bool TryAs(BorrowedPtr<TCast>& out) const {
|
template <class TCast> inline bool TryAs(BorrowedPtr<TCast>& out) const {
|
||||||
auto cast = dynamic_cast<TCast>(_raw);
|
auto cast = dynamic_cast<TCast*>(_raw);
|
||||||
if (cast == nullptr)
|
if (cast == nullptr)
|
||||||
return false;
|
return false;
|
||||||
out = BorrowedPtr<TCast>(cast);
|
out = BorrowedPtr<TCast>(cast);
|
||||||
|
@ -46,7 +46,7 @@ namespace ArbUt {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class TCast> inline BorrowedPtr<TCast> ForceAs() const {
|
template <class TCast> inline BorrowedPtr<TCast> ForceAs() const {
|
||||||
auto cast = reinterpret_cast<TCast>(_raw);
|
auto cast = reinterpret_cast<TCast*>(_raw);
|
||||||
return BorrowedPtr<TCast>(cast);
|
return BorrowedPtr<TCast>(cast);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue