Fix missing operators and constructor in Pair
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "Engine/Core/Templates.h"
|
||||||
#include "Engine/Core/Collections/HashFunctions.h"
|
#include "Engine/Core/Collections/HashFunctions.h"
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -45,41 +46,44 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Pair"/> class.
|
/// Initializes a new instance of the <see cref="Pair"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key">The key.</param>
|
/// <param name="other">The other pair.</param>
|
||||||
Pair(const T& key)
|
Pair(const Pair& other)
|
||||||
: First(key)
|
: First(other.First)
|
||||||
|
, Second(other.Second)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Pair"/> class.
|
/// Initializes a new instance of the <see cref="Pair"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="p">The other pair.</param>
|
/// <param name="other">The other pair.</param>
|
||||||
Pair(const Pair& p)
|
Pair(Pair&& other) noexcept
|
||||||
: First(p.First)
|
: First(MoveTemp(other.First))
|
||||||
, Second(p.Second)
|
, Second(MoveTemp(other.Second))
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="Pair"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="p">The other pair.</param>
|
|
||||||
Pair(Pair* p)
|
|
||||||
: First(p->First)
|
|
||||||
, Second(p->Second)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Finalizes an instance of the <see cref="Pair"/> class.
|
|
||||||
/// </summary>
|
|
||||||
~Pair()
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
Pair& operator=(const Pair& other)
|
||||||
|
{
|
||||||
|
if (this == &other)
|
||||||
|
return *this;
|
||||||
|
First = other.First;
|
||||||
|
Second = other.Second;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Pair& operator=(Pair&& other) noexcept
|
||||||
|
{
|
||||||
|
if (this != &other)
|
||||||
|
{
|
||||||
|
First = MoveTemp(other.First);
|
||||||
|
Second = MoveTemp(other.Second);
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
friend bool operator==(const Pair& a, const Pair& b)
|
friend bool operator==(const Pair& a, const Pair& b)
|
||||||
{
|
{
|
||||||
return a.First == b.First && a.Second == b.Second;
|
return a.First == b.First && a.Second == b.Second;
|
||||||
|
|||||||
Reference in New Issue
Block a user