Skip to content

Commit f43a078

Browse files
committed
SafePtr: tiny
1 parent 0cdb517 commit f43a078

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/safe_mem/SafePtr.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SafePtr
7474
template<typename From> void init_(const SafePtr<From>&) noexcept;
7575

7676
// -------------------------------------------------------------------------------------------
77-
shared_ptr<T> pT_;
77+
shared_ptr<T> pT_; // core
7878
type_index realType_ = typeid(T); // origin type
7979
type_index lastType_ = typeid(T); // maybe last valid type than realType_ & void
8080
};
@@ -113,7 +113,7 @@ shared_ptr<To> SafePtr<T>::cast() const noexcept
113113
//HID("(SafePtr) cast to derived");
114114
return dynamic_pointer_cast<To>(pT_);
115115
}
116-
else if constexpr(is_void_v<To>)
116+
else if constexpr(is_void_v<To>)
117117
{
118118
//HID("(SafePtr) cast to void (for container to store diff types)");
119119
return pT_;
@@ -152,7 +152,7 @@ void SafePtr<T>::init_(const SafePtr<From>& aSafeFrom) noexcept
152152

153153
realType_ = aSafeFrom.realType();
154154
// save last useful type
155-
if (type_index(typeid(T)) != realType_ && !is_same_v<T, void>)
155+
if (!is_same_v<T, void> && type_index(typeid(T)) != realType_)
156156
lastType_ = type_index(typeid(T));
157157
else
158158
lastType_ = aSafeFrom.lastType();
@@ -205,16 +205,16 @@ bool operator<(SafePtr<T> lhs, SafePtr<U> rhs)
205205

206206
// ***********************************************************************************************
207207
template<typename To, typename From>
208-
SafePtr<To> static_pointer_cast(const SafePtr<From>& aFromPtr) noexcept
208+
SafePtr<To> static_pointer_cast(const SafePtr<From>& aSafeFrom) noexcept
209209
{
210-
return dynamic_pointer_cast<To>(aFromPtr);
210+
return dynamic_pointer_cast<To>(aSafeFrom);
211211
}
212212
} // namespace
213213

214214
template<typename T>
215215
struct std::hash<RLib::SafePtr<T>>
216216
{
217-
auto operator()(const RLib::SafePtr<T>& aSafeAdr) const { return hash<shared_ptr<T>>()(aSafeAdr.get()); }
217+
auto operator()(const RLib::SafePtr<T>& aSafePtr) const { return hash<shared_ptr<T>>()(aSafePtr.get()); }
218218
};
219219

220220
// ***********************************************************************************************

0 commit comments

Comments
 (0)