Added comparison operators to UniquePointer and UniqueArray
operator == operator !=
This commit is contained in:
parent
07e3aa1697
commit
23d3af21c6
|
@ -90,6 +90,18 @@ namespace Utility
|
||||||
return this->ownedInstance != NULL;
|
return this->ownedInstance != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
bool UniquePointer<Type>::operator == ( Type *stray ) const
|
||||||
|
{
|
||||||
|
return this->ownedInstance == stray;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
bool UniquePointer<Type>::operator != ( Type *stray ) const
|
||||||
|
{
|
||||||
|
return this->ownedInstance != stray;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
Type* UniquePointer<Type>::Release()
|
Type* UniquePointer<Type>::Release()
|
||||||
{
|
{
|
||||||
|
@ -149,6 +161,18 @@ namespace Utility
|
||||||
return this->ownedArray != NULL;
|
return this->ownedArray != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
bool UniqueArray<Type>::operator == ( Type *stray ) const
|
||||||
|
{
|
||||||
|
return this->ownedArray == stray;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Type>
|
||||||
|
bool UniqueArray<Type>::operator != ( Type *stray ) const
|
||||||
|
{
|
||||||
|
return this->ownedArray != stray;
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
Type* UniqueArray<Type>::Release()
|
Type* UniqueArray<Type>::Release()
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,6 +56,12 @@ namespace Utility
|
||||||
//! If true, this UniquePointer have a current ownership/responsibility of a dynamic instance.
|
//! If true, this UniquePointer have a current ownership/responsibility of a dynamic instance.
|
||||||
operator bool () const;
|
operator bool () const;
|
||||||
|
|
||||||
|
//! @return true if this ownedInstance matches with stray
|
||||||
|
bool operator == ( Type *stray ) const;
|
||||||
|
|
||||||
|
//! @return false if this ownedInstance matches with stray
|
||||||
|
bool operator != ( Type *stray ) const;
|
||||||
|
|
||||||
//! This UniquePointer drops all claims of ownership/responsibility and returns the dynamic instance. Now it is your responsibility to delete.
|
//! This UniquePointer drops all claims of ownership/responsibility and returns the dynamic instance. Now it is your responsibility to delete.
|
||||||
Type* Release();
|
Type* Release();
|
||||||
|
|
||||||
|
@ -96,6 +102,12 @@ namespace Utility
|
||||||
//! If true, this UniqueArray have a current ownership/responsibility of a dynamic instance.
|
//! If true, this UniqueArray have a current ownership/responsibility of a dynamic instance.
|
||||||
operator bool () const;
|
operator bool () const;
|
||||||
|
|
||||||
|
//! @return true if this ownedInstance matches with stray
|
||||||
|
bool operator == ( Type *stray ) const;
|
||||||
|
|
||||||
|
//! @return false if this ownedInstance matches with stray
|
||||||
|
bool operator != ( Type *stray ) const;
|
||||||
|
|
||||||
//! This UniqueArray drops all claims of ownership/responsibility and returns the dynamic array. Now it is your responsibility to delete.
|
//! This UniqueArray drops all claims of ownership/responsibility and returns the dynamic array. Now it is your responsibility to delete.
|
||||||
Type* Release();
|
Type* Release();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue