# Unreal Engine 5 c++ GetValueTypeHash definition in TSet\<customStruct\>

**URL:** <https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977>\
**Category:** C++\
**Tags:** unreal-engine, UE5-0, question, CPP\
**Created:** [July 26, 2022, 8:40pm UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977 "2022-07-26T20:40:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AceHigh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AceHigh](https://forums.unrealengine.com/u/AceHigh)\
**Post date:** [July 26, 2022, 8:40pm UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/1 "2022-07-26T20:40:05Z")

</div>

I a trying to create a set of structs using TSet, however, when I compile I get the error:

The structure `Fpiece` is used in a `TSet` but does not have a `GetValueTypeHash` defined

How do I implement a `GetValueTypeHash` definition in my `struct`?

```auto
USTRUCT(BlueprintType)
struct Fpiece
{
    GENERATED_BODY()
        // Use UPROPERTY() to decorate member variables as they allow for easier integration with network replication as well as potential garbage collection processing
    UPROPERTY(BlueprintReadOnly, Category = Tutorial) int color;
    UPROPERTY(BlueprintReadOnly, Category = Tutorial) int man;
    UPROPERTY(BlueprintReadOnly, Category = Tutorial) int locationX;
    UPROPERTY(BlueprintReadOnly, Category = Tutorial) int locationY;
    UPROPERTY(BlueprintReadOnly, Category = Tutorial) int point;

};

```

and in the public class definitions:

```auto
UPROPERTY(BlueprintReadOnly, Category = Tutorial) TSet<Fpiece> pieces;

```

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [July 26, 2022, 10:41pm UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/2 "2022-07-26T22:41:14Z")

</div>

Add this in your header  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/0/2f0d0e2c61cd24741176f93eaa1500e51d18ceb5.png)

and implement this like this  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/e/d/7ed764709e6ed469ce3bd71c99d9fcc7c27892fb.png)

---

<div class="post-metadata">

**Author:** ![AceHigh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AceHigh](https://forums.unrealengine.com/u/AceHigh)\
**Post date:** [July 26, 2022, 10:57pm UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/3 "2022-07-26T22:57:32Z")

</div>

thanks. worked perfectly.

---

<div class="post-metadata">

**Author:** ![KaidoomDev](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/kaidoomdev/32/977996_2.png) [@KaidoomDev](https://forums.unrealengine.com/u/KaidoomDev)\
**Post date:** [July 27, 2022, 2:24am UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/4 "2022-07-27T02:24:35Z")

</div>

You’re welcome, make sure you mark this as answered so others can find it easily.

---

<div class="post-metadata">

**Author:** ![AceHigh](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AceHigh](https://forums.unrealengine.com/u/AceHigh)\
**Post date:** [September 3, 2022, 1:28pm UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/5 "2022-09-03T13:28:47Z")

</div>

What’s the proper way to implement the `operator==` overload on the same `struct`?

---

<div class="post-metadata">

**Author:** ![MattG\_ZeroFill](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mattg_zerofill/32/563889_2.png) [@MattG\_ZeroFill](https://forums.unrealengine.com/u/MattG_ZeroFill)\
**Post date:** [September 14, 2022, 2:22am UTC](https://forums.unrealengine.com/t/unreal-engine-5-c-getvaluetypehash-definition-in-tset-customstruct/614977/6 "2022-09-14T02:22:46Z")

</div>

```auto
inline bool operator ==(const Fpiece& other) const
    {
        return SomeData == other.SomeData;
    }

```

You can use any combination of member variables or just one. This type of overload goes _inside_ of the UStruct.
