Fixes OptionalBorrowedPtr casts.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-12-12 13:50:09 +01:00
parent 96315cb857
commit 4466aeeee6
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 3 additions and 3 deletions

View File

@ -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.