Skip to content

Commit

Permalink
SafeAdr: comments
Browse files Browse the repository at this point in the history
  • Loading branch information
fchn289 committed May 1, 2024
1 parent 7e86ee2 commit d838353
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/safe_mem/SafeAdr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ shared_ptr<To> SafeAdr<T>::cast() const noexcept
else if constexpr(!is_void<T>::value)
{
HID("(SafeAdr) casting from=" << typeid(T).name() << " to=" << typeid(To).name());
return pT_; // compile-err is safer than ret null
return this; // force compile-err, safer than ret pT_ or null
}
else if (&typeid(To) == realType_)
{
Expand Down Expand Up @@ -235,6 +235,9 @@ struct std::hash<RLib::SafeAdr<T>>
// . freq cast void->any is dangeous
// . so worth
//
// . std::any vs SafeAdr
// . SafeAdr is safe shared_ptr that is lifecycle ptr, std::any is not ptr nor lifecycle mgmt
//
// . T not ref/ptr/const?
// . SafeRef? or like this?
// . how about class' this?

0 comments on commit d838353

Please sign in to comment.