Fixed potential ambiguity bug
Ambiguity in assignment operator with UniquePointer and UniqueArray
This commit is contained in:
parent
045cfe28fe
commit
036519f3f6
|
@ -148,15 +148,20 @@
|
|||
<ItemGroup>
|
||||
<ClCompile Include="Resource\Loaders\ByteLoader.cpp" />
|
||||
<ClCompile Include="Resource\Loaders\CustomLoader.cpp" />
|
||||
<ClCompile Include="Resource\OResourceHandler.cpp" />
|
||||
<ClCompile Include="Resource\OResource.cpp" />
|
||||
<ClCompile Include="Resource\OResourceHandler.cpp" />
|
||||
<ClCompile Include="Thread\OysterMutex.cpp" />
|
||||
<ClCompile Include="Thread\OysterThread_Impl.cpp" />
|
||||
<ClCompile Include="Utilities.cpp" />
|
||||
<ClCompile Include="WinTimer.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Resource\OysterResource.h" />
|
||||
<ClInclude Include="Resource\OResource.h" />
|
||||
<ClInclude Include="Utilities-InlineImpl.h" />
|
||||
<ClInclude Include="Resource\OysterResource.h" />
|
||||
<ClInclude Include="Thread\IThreadObject.h" />
|
||||
<ClInclude Include="Thread\OysterMutex.h" />
|
||||
<ClInclude Include="Thread\OysterThread.h" />
|
||||
<ClInclude Include="Utilities-Impl.h" />
|
||||
<ClInclude Include="Utilities.h" />
|
||||
<ClInclude Include="WinTimer.h" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
<ClCompile Include="Resource\OResourceHandler.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Thread\OysterMutex.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Thread\OysterThread_Impl.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Resource\Loaders\ByteLoader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -41,14 +47,23 @@
|
|||
<ClInclude Include="WinTimer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utilities-InlineImpl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource\OysterResource.h">
|
||||
<ClInclude Include="Utilities-Impl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource\OResource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource\OysterResource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Thread\IThreadObject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Thread\OysterMutex.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Thread\OysterThread.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,7 +1,11 @@
|
|||
/////////////////////////////////////////////////////////////////////
|
||||
// Inline and template implementations for
|
||||
// the Utility Collection of Miscellanious Handy Functions
|
||||
// © Dan Andersson 2013
|
||||
//
|
||||
// Created 2013 by Dan Andersson
|
||||
// Edited 2013 by
|
||||
// * Dan Andersson
|
||||
// * Dennis Andersen
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UTILITIES_INLINE_IMPL_H
|
||||
|
@ -51,14 +55,6 @@ namespace Utility
|
|||
SafeDeleteInstance( this->ownedInstance );
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
UniquePointer<Type> & UniquePointer<Type>::operator = ( Type *assignedInstance )
|
||||
{
|
||||
SafeDeleteInstance( this->ownedInstance );
|
||||
this->ownedInstance = assignedInstance;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
UniquePointer<Type> & UniquePointer<Type>::operator = ( const UniquePointer<Type> &donor )
|
||||
{
|
||||
|
@ -144,13 +140,6 @@ namespace Utility
|
|||
SafeDeleteArray( this->ownedArray );
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
UniqueArray<Type> & UniqueArray<Type>::operator = ( Type assignedArray[] )
|
||||
{
|
||||
SafeDeleteArray( this->ownedArray );
|
||||
this->ownedArray = assignedArray;
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
UniqueArray<Type> & UniqueArray<Type>::operator = ( const UniqueArray<Type> &donor )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Utility Collection of Miscellanious Handy Functions
|
||||
// © Dan Andersson 2013
|
||||
//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!//!
|
||||
//
|
||||
// Created 2013 by Dan Andersson
|
||||
// Edited 2013 by
|
||||
// * Dan Andersson
|
||||
// * Dennis Andersen
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef UTILITIES_H
|
||||
#define UTILITIES_H
|
||||
|
@ -27,12 +31,9 @@ namespace Utility
|
|||
template<typename Type> struct UniquePointer
|
||||
{
|
||||
public:
|
||||
//! Creates an empty UniquePointer.
|
||||
//UniquePointer();
|
||||
|
||||
//! Assigns assignedInstance ownership to this UniquePonter, old owned instance will be deleted.
|
||||
//! If NULL is assigned is equivalent with clearing all responsibilities from this UniquePointer.
|
||||
UniquePointer( Type *assignedInstance = NULL );
|
||||
UniquePointer( Type *assignedInstance = NULL );
|
||||
|
||||
//! Transfers assignedInstance ownership from donor to this UniquePonter, old owned instance will be deleted.
|
||||
//! If donor had nothing, is equivalent with clearing all responsibilities from this UniquePointer.
|
||||
|
@ -41,10 +42,6 @@ namespace Utility
|
|||
//! Will auto delete assigned dynamic instance.
|
||||
~UniquePointer();
|
||||
|
||||
//! Assigns assignedInstance ownership to this UniquePonter, old owned instance will be deleted.
|
||||
//! If NULL is assigned is equivalent with clearing all responsibilities from this UniquePointer.
|
||||
UniquePointer<Type> & operator = ( Type *assignedInstance ); // potential ambiguous
|
||||
|
||||
//! Transfers assignedInstance ownership from donor to this UniquePonter, old owned instance will be deleted.
|
||||
//! If donor had nothing, is equivalent with clearing all responsibilities from this UniquePointer.
|
||||
UniquePointer<Type> & operator = ( const UniquePointer<Type> &donor );
|
||||
|
@ -84,9 +81,6 @@ namespace Utility
|
|||
struct UniqueArray
|
||||
{ //! Wrapper to safely transfer dynamic ownership/responsibility
|
||||
public:
|
||||
//! Creates an empty UniqueArray.
|
||||
//UniqueArray();
|
||||
|
||||
//! Assigns assignedInstance ownership to this UniquePonter, old owned array will be deleted.
|
||||
//! If NULL is assigned is equivalent with clearing all responsibilities from this UniqueArray.
|
||||
UniqueArray( Type assignedArray[] = NULL );
|
||||
|
@ -98,10 +92,6 @@ namespace Utility
|
|||
//! Will auto delete assigned dynamic array.
|
||||
~UniqueArray();
|
||||
|
||||
//! Assigns assignedInstance ownership to this UniquePonter, old owned array will be deleted.
|
||||
//! If NULL is assigned is equivalent with clearing all responsibilities from this UniqueArray.
|
||||
UniqueArray<Type> & operator = ( Type assignedArray[] ); // potential ambiguous
|
||||
|
||||
//! Transfers assignedInstance ownership from donor to this UniquePonter, old owned array will be deleted.
|
||||
//! If donor had nothing, is equivalent with clearing all responsibilities from this UniqueArray.
|
||||
UniqueArray<Type> & operator = ( const UniqueArray<Type> &donor );
|
||||
|
|
Loading…
Reference in New Issue