diff options
author | Jacques Lucke <jacques@blender.org> | 2021-12-27 18:08:11 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-27 18:08:11 +0300 |
commit | 51a131ddbc2eeebd13cdc6a71b2d356267fda73e (patch) | |
tree | f85e2e4f2f809e0ebba5876428a1d07ed6ea20cc /source/blender/nodes | |
parent | 594438ef0d6135a5bbf9101292db9f2d3aca9312 (diff) |
BLI: add utility to check if type is any specific type
This adds `blender::is_same_any_v` which is the almost the same as
`std::is_same_v`. The difference is that it allows for checking multiple
types at the same time.
Differential Revision: https://developer.blender.org/D13673
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/NOD_geometry_exec.hh | 8 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc | 3 |
2 files changed, 3 insertions, 8 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index f225b3b94b2..2246cc29dc4 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -134,12 +134,8 @@ class GeoNodeExecParams { } template<typename T> - static inline constexpr bool is_field_base_type_v = std::is_same_v<T, float> || - std::is_same_v<T, int> || - std::is_same_v<T, bool> || - std::is_same_v<T, ColorGeometry4f> || - std::is_same_v<T, float3> || - std::is_same_v<T, std::string>; + static inline constexpr bool is_field_base_type_v = + is_same_any_v<T, float, int, bool, ColorGeometry4f, float3, std::string>; /** * Get the input value for the input socket with the given identifier. diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index bf7a9f49829..1d483709a0a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -180,8 +180,7 @@ static void join_component_type(Span<GeometrySet> src_geometry_sets, GeometrySet InstancesComponent &instances = instances_geometry_set.get_component_for_write<InstancesComponent>(); - if constexpr (std::is_same_v<Component, InstancesComponent> || - std::is_same_v<Component, VolumeComponent>) { + if constexpr (is_same_any_v<Component, InstancesComponent, VolumeComponent>) { join_components(components, result); } else { |