diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-04-21 11:28:30 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-04-23 00:12:05 +0300 |
commit | a60215f058845e14084132c82ddce3c3b028c80f (patch) | |
tree | 589dc5898e5db74b628d45ee2aad89e987c47d08 /source/blender/blenlib/BLI_memory_utils.hh | |
parent | 2882cbe685e7eca2a79438998354035c5d665205 (diff) |
EEVEE: Rewrite: Implement nodetree support with every geometry typestmp-eevee-next-merge
Diffstat (limited to 'source/blender/blenlib/BLI_memory_utils.hh')
-rw-r--r-- | source/blender/blenlib/BLI_memory_utils.hh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh index a7cad5461b4..d7c41ae88a8 100644 --- a/source/blender/blenlib/BLI_memory_utils.hh +++ b/source/blender/blenlib/BLI_memory_utils.hh @@ -543,6 +543,18 @@ Container &move_assign_container(Container &dst, Container &&src) noexcept( return dst; } +/** + * Returns true if the value is different and was assigned. + */ +template<typename T> inline bool assign_if_different(T &old_value, T new_value) +{ + if (old_value != new_value) { + old_value = std::move(new_value); + return true; + } + return false; +} + } // namespace blender namespace blender::detail { |