Skip to content

Commit b58f77f

Browse files
Don't wrap lambdas pointlessly (#9138)
repeat_edge(imageparam) has *two* wrapper Funcs around it. The imageparam comes with one (accessible via its implicit cast to Func operator), and then because it's not exactly a Func, the boundary condition helper adds another one. This commit changes the boundary condition helper to use a class's existing implicit conversion to a Func if there is one, avoiding the pointless extra Func. The else case is still necessary because a Halide::Buffer can be accessed like a Func, but not implicitly cast to a Func. Co-authored-by: Alex Reinking <areinking@adobe.com>
1 parent 0232209 commit b58f77f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/BoundaryConditions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ inline HALIDE_NO_USER_CODE_INLINE void collect_region(Region &collected_args,
6464

6565
template<typename T>
6666
Func func_like_to_func(T &&func_like) {
67-
if constexpr (std::is_same_v<std::decay_t<T>, Func>) {
67+
if constexpr (std::is_convertible_v<T, Func>) {
6868
return std::forward<T>(func_like);
6969
} else {
7070
return lambda(_, func_like(_));

0 commit comments

Comments
 (0)