From f8bb311fcbaaf2f6839840f9e5e9c2be73147193 Mon Sep 17 00:00:00 2001 From: DarkSharpness <2040703891@qq.com> Date: Thu, 11 Jul 2024 18:48:02 +0800 Subject: [PATCH] fix(sync): do not sync const objects --- include/synchronize.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/synchronize.h b/include/synchronize.h index eed40d0..3b112af 100644 --- a/include/synchronize.h +++ b/include/synchronize.h @@ -42,7 +42,9 @@ inline void sync_by_tag(_Tp &value, SyncTags<_Base...>) { template inline void sync_member(_Tp &value) { - if constexpr (is_std_array_v<_Tp>) { + if constexpr (std::is_const_v <_Tp>) { + /* Do nothing! Constant members need no synchronization! */ + } else if constexpr (is_std_array_v<_Tp>) { for (auto &member : value) sync_member(member); } else if constexpr (Visitor::is_syncable_v<_Tp>) { Visitor::sync(value);