diff options
author | Ray Molenkamp <github@lazydodo.com> | 2022-10-27 18:16:51 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2022-10-27 18:16:51 +0300 |
commit | c967bdcbb1e8496c1e0d440aebb4bab97ad4508b (patch) | |
tree | 54132dcf437211d9c7208d83ce196b193797c263 /source/blender/gpencil_modifiers/intern | |
parent | 2625c39ce77ba303e44d9ea90ee8d1bc09c0f336 (diff) |
GPencil: Fix MSVC warning in lineart_cpp_bridge.cc
MSVC give a rather large warning when using blender::parallel_sort
without using a lambda for the comparison.
Fixed by using a lambda
Diffstat (limited to 'source/blender/gpencil_modifiers/intern')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc index 5e741ccbd55..85f158d42e6 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpp_bridge.cc @@ -9,17 +9,15 @@ #include "MOD_lineart.h" #include "lineart_intern.h" -static bool cmp_adjacent_items(const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2) -{ - int a = p1.v1 - p2.v1; - int b = p1.v2 - p2.v2; - /* parallel_sort() requires cmp() to return true when the first element needs to appear before - * the second element in the sorted array, false otherwise (strict weak ordering), see - * https://en.cppreference.com/w/cpp/named_req/Compare. */ - return a < 0 ? true : (a == 0 ? b < 0 : false); -} - void lineart_sort_adjacent_items(LineartAdjacentEdge *ai, int length) { - blender::parallel_sort(ai, ai + length, cmp_adjacent_items); + blender::parallel_sort( + ai, ai + length, [](const LineartAdjacentEdge &p1, const LineartAdjacentEdge &p2) { + int a = p1.v1 - p2.v1; + int b = p1.v2 - p2.v2; + /* parallel_sort() requires cmp() to return true when the first element needs to appear + * before the second element in the sorted array, false otherwise (strict weak ordering), + * see https://en.cppreference.com/w/cpp/named_req/Compare. */ + return a < 0 ? true : (a == 0 ? b < 0 : false); + }); } |