Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make conj_if_needed inline
Browse files Browse the repository at this point in the history
This avoids any ODR violations for the lambda itself.
It's a generic lambda, so we don't have to worry about its operator().

Fixes kokkos#246.
mhoemmen committed Jul 12, 2022
1 parent 073bea8 commit 4b642cd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/experimental/__p1673_bits/conjugate_if_needed.hpp
Original file line number Diff line number Diff line change
@@ -83,8 +83,9 @@ auto conj_if_needed_impl(const T& t, std::true_type)
return conj(t);
}
}

auto conj_if_needed = [](const auto& t)

// Inline static variables require C++17.
constexpr inline auto conj_if_needed = [](const auto& t)
{
using T = std::remove_const_t<decltype(t)>;
return conj_if_needed_impl(t, has_conj<T>{});

0 comments on commit 4b642cd

Please sign in to comment.