Fixes OptionalBorrowedPtr casts.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -58,12 +58,12 @@ namespace ArbUt {
|
|||||||
inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; }
|
inline bool operator!=(T* rhs) const noexcept { return _raw != rhs; }
|
||||||
|
|
||||||
/// @brief Returns a const version of the underlying pointer.
|
/// @brief Returns a const version of the underlying pointer.
|
||||||
inline OptionalBorrowedPtr<const T> Const() const noexcept { return BorrowedPtr<const T>(_raw); }
|
inline OptionalBorrowedPtr<const T> Const() const noexcept { return OptionalBorrowedPtr<const T>(_raw); }
|
||||||
|
|
||||||
/// @brief Casts the underlying pointer to another type using dynamic_cast.
|
/// @brief Casts the underlying pointer to another type using dynamic_cast.
|
||||||
template <class TCast> inline OptionalBorrowedPtr<TCast> As() const {
|
template <class TCast> inline OptionalBorrowedPtr<TCast> As() const {
|
||||||
auto cast = dynamic_cast<TCast*>(_raw);
|
auto cast = dynamic_cast<TCast*>(_raw);
|
||||||
return BorrowedPtr<TCast>(cast);
|
return OptionalBorrowedPtr<TCast>(cast);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Try to cast the underlying pointer to another type using dynamic_cast.
|
/// @brief Try to cast the underlying pointer to another type using dynamic_cast.
|
||||||
@@ -78,7 +78,7 @@ namespace ArbUt {
|
|||||||
/// @brief Force cast the underlying pointer to another type using reinterpret_cast.
|
/// @brief Force cast the underlying pointer to another type using reinterpret_cast.
|
||||||
template <class TCast> inline OptionalBorrowedPtr<TCast> ForceAs() const noexcept {
|
template <class TCast> inline OptionalBorrowedPtr<TCast> ForceAs() const noexcept {
|
||||||
auto cast = reinterpret_cast<TCast*>(_raw);
|
auto cast = reinterpret_cast<TCast*>(_raw);
|
||||||
return BorrowedPtr<TCast>(cast);
|
return OptionalBorrowedPtr<TCast>(cast);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Implicit cast to retrieve raw pointer.
|
/// @brief Implicit cast to retrieve raw pointer.
|
||||||
|
|||||||
Reference in New Issue
Block a user