[+] Added casts for pointer types
[*] Nuke more std:: references
This commit is contained in:
parent
6e8bb527e7
commit
be7e9271e6
@ -12,7 +12,7 @@ namespace Aurora::Threading::Waitables
|
||||
class CBWaitable : public IWaitable
|
||||
{
|
||||
public:
|
||||
CBWaitable(const std::function<bool()> &value) : callback_(value)
|
||||
CBWaitable(const AuFunction<bool()> &value) : callback_(value)
|
||||
{
|
||||
}
|
||||
|
||||
@ -48,6 +48,6 @@ namespace Aurora::Threading::Waitables
|
||||
}
|
||||
|
||||
private:
|
||||
std::function<bool()> callback_;
|
||||
AuFunction<bool()> callback_;
|
||||
};
|
||||
}
|
@ -7,6 +7,12 @@
|
||||
***/
|
||||
#pragma once
|
||||
|
||||
template<class T, class Z>
|
||||
T *AuStaticCast(Z *other)
|
||||
{
|
||||
return static_cast<T *>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
AuSPtr<T> AuStaticCast(const AuSPtr<Z> &other)
|
||||
{
|
||||
@ -19,6 +25,12 @@ AuSPtr<T> AuStaticCast(AuSPtr<Z> &&other)
|
||||
return AuSPtr<T>(AuMove(other), static_cast<T *>(other.get()));
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
T *AuConstCast(Z *other)
|
||||
{
|
||||
return const_cast<T *>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
AuSPtr<T> AuConstCast(const AuSPtr<Z> &other)
|
||||
{
|
||||
@ -31,6 +43,12 @@ AuSPtr<T> AuConstCast(AuSPtr<Z> &&other)
|
||||
return AuSPtr<T>(AuMove(other), const_cast<T *>(other.get()));
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
T *AuReinterpretCast(Z *other)
|
||||
{
|
||||
return reinterpret_cast<T *>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
AuSPtr<T> AuReinterpretCast(const AuSPtr<Z> &other)
|
||||
{
|
||||
@ -43,6 +61,12 @@ AuSPtr<T> AuReinterpretCast(AuSPtr<Z> &&other)
|
||||
return AuSPtr<T>(AuMove(other), reinterpret_cast<T *>(other.get()));
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
T *AuDynamicCast(Z *other)
|
||||
{
|
||||
return dynamic_cast<T *>(other);
|
||||
}
|
||||
|
||||
template<class T, class Z>
|
||||
AuSPtr<T> AuDynamicCast(const AuSPtr<Z> &other)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace Aurora::Async
|
||||
bool status {};
|
||||
|
||||
{
|
||||
auto dependency = std::reinterpret_pointer_cast<WorkItem>(workItem);
|
||||
auto dependency = AuReinterpretCast<WorkItem>(workItem);
|
||||
|
||||
AU_LOCK_GUARD(this->lock);
|
||||
AU_LOCK_GUARD(dependency->lock);
|
||||
|
@ -134,7 +134,7 @@ namespace Aurora::Crypto::ECC
|
||||
}
|
||||
|
||||
unsigned long actualSize = sharedSecret.size();
|
||||
auto ret = ecc_shared_secret(&_key, &(std::reinterpret_pointer_cast<PublicECCImpl>(partnerPublic)->GetKey()), sharedSecret.data(), &actualSize);
|
||||
auto ret = ecc_shared_secret(&_key, &(AuReinterpretCast<PublicECCImpl>(partnerPublic)->GetKey()), sharedSecret.data(), &actualSize);
|
||||
if (ret != CRYPT_OK)
|
||||
{
|
||||
SysPushErrorCrypt("{}", ret);
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex) : mutex_(std::dynamic_pointer_cast<ConditionMutexImpl>(mutex))
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex) : mutex_(AuDynamicCast<ConditionMutexImpl>(mutex))
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace Aurora::Threading::Primitives
|
||||
{
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex) : mutex_(std::dynamic_pointer_cast<IConditionMutexEx>(mutex))
|
||||
ConditionVariableImpl::ConditionVariableImpl(const AuSPtr<IConditionMutex> &mutex) : mutex_(AuDynamicCast<IConditionMutexEx>(mutex))
|
||||
{
|
||||
InitializeConditionVariable(&winCond_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user