# Struct in C++ Delegate, pass by value or by const ref?

**URL:** <https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, CPP, question\
**Created:** [June 24, 2025, 12:33pm UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613 "2025-06-24T12:33:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sitiana](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sitiana/32/1194605_2.png) [@Sitiana](https://forums.unrealengine.com/u/Sitiana)\
**Post date:** [June 24, 2025, 12:33pm UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/1 "2025-06-24T12:33:49Z")

</div>

Hello Devs,

I’m creating a tool in which users can use Blueprint and C++ delegates. I’m wondering if there is a preferred or correct way to pass structs in Delegates.

By const ref:

```auto
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnGetUserDataResponse, const FOperationResult&, Result, const FUserData&, UserData);
DECLARE_DELEGATE_TwoParams(FOnGetUserDataResponseNative, const FOperationResult& Result, const FUserData& UserData);

```

By value:

```auto
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnGetUserDataResponse, FOperationResult, Result, FUserData, UserData);
DECLARE_DELEGATE_TwoParams(FOnGetUserDataResponseNative, FOperationResult Result, FUserData UserData);

```

I know technical difference between passing by value and by ref. I’m just wondering if any of these is better for Blueprints reflections system.  
AI Chat scared me with this sentence:  
` **Only trivial USTRUCTs should be passed by `const&` in dynamic delegates**.`  
So looking for more experienced devs opinion 🙂

---

<div class="post-metadata">

**Author:** ![Sitiana](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sitiana/32/1194605_2.png) [@Sitiana](https://forums.unrealengine.com/u/Sitiana)\
**Post date:** [June 26, 2025, 6:59am UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/2 "2025-06-26T06:59:11Z")

</div>

As I haven’t received any answer here I tried to read all possible resources and chat with multiple bots. I ended up passing by value in `DYNAMIC` delegates and by reference in non Dynamic/Native ones:

```auto
DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnGetUserDataResponse, FOperationResult, Result, FUserData, UserData);
DECLARE_DELEGATE_TwoParams(FOnGetUserDataResponseNative, const FOperationResult& Result, const FUserData& UserData);

```

Why:

- `DYNAMIC` delegates need to support Blueprints so passing by value is much safer and better support BPs.

- `Native` delegates can be use in C++ only, so performance is the key here. We don’t do unnecessary copying.

Anyway I’m still open to any suggestions.

---

<div class="post-metadata">

**Author:** ![PREDALIEN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/predalien/32/1194670_2.png) [@PREDALIEN](https://forums.unrealengine.com/u/PREDALIEN)\
**Post date:** [June 26, 2025, 7:57am UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/3 "2025-06-26T07:57:25Z")

</div>

There is a problem:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/f/1/ff1e6f96eebab3a05fe21920c7b635e025d0bd69.png)

---

<div class="post-metadata">

**Author:** ![Sitiana](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sitiana/32/1194605_2.png) [@Sitiana](https://forums.unrealengine.com/u/Sitiana)\
**Post date:** [June 26, 2025, 8:07am UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/4 "2025-06-26T08:07:55Z")

</div>

Hmm I tested multiple times those delegates and I have never received such warning. Can you paste the Delegate declaration?

---

<div class="post-metadata">

**Author:** ![PREDALIEN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/predalien/32/1194670_2.png) [@PREDALIEN](https://forums.unrealengine.com/u/PREDALIEN)\
**Post date:** [June 26, 2025, 8:09am UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/5 "2025-06-26T08:09:46Z")

</div>

> [@Sitiana](#):
>
> declaration

I created it directly in blueprint

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/c/c/6ccac108040942861b9fdd4123944961b667c20f.png)

---

<div class="post-metadata">

**Author:** ![Sitiana](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sitiana/32/1194605_2.png) [@Sitiana](https://forums.unrealengine.com/u/Sitiana)\
**Post date:** [June 26, 2025, 8:12am UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/6 "2025-06-26T08:12:34Z")

</div>

Ahh ok, that might be the case. I declared all my Delegates in C++, so they are usable in C++ and Blueprints.  
I haven’t tried BP event dispatcher for this case. Thanks for checking!

---

<div class="post-metadata">

**Author:** ![Dayaern](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Dayaern](https://forums.unrealengine.com/u/Dayaern)\
**Post date:** [November 15, 2026, 12:47pm UTC](https://forums.unrealengine.com/t/struct-in-c-delegate-pass-by-value-or-by-const-ref/2573613/7 "2026-11-15T12:47:15Z")

</div>

I appreciate you showing this by the way. I was having a rough time setting a delegate and realized that the Native (C++) option is a lot faster than the reflected one (Dynamic is reflected - non-dynamic isn’t).

I must also not use UFUNCTION() and UPROPERTY() on the Native delegate (mandatory for a DYNAMIC one).

Much appreciated for sharing this. It helped me in a rather unintended way but this is very important for my work.
