Skip to content

Commit bc3809e

Browse files
committed
Avoid if constexpr, msvc doesnt get it
1 parent 1fbc579 commit bc3809e

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/auxiliary/Future.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,17 @@ auto DeferredComputation<T>::get() -> T
8787
return std::visit(
8888
auxiliary::overloaded{
8989
[](detail::OneTimeTask<T> &task) -> T { return std::move(task)(); },
90-
[](detail::CachedValue<T> &cached) -> T {
91-
if constexpr (std::is_void_v<T>)
92-
{
93-
return;
94-
}
95-
else
96-
{
97-
return cached.val;
98-
}
99-
}},
90+
[](detail::CachedValue<T> &cached) -> T { return cached.val; }},
91+
this->m_task);
92+
}
93+
94+
template <>
95+
auto DeferredComputation<void>::get() -> void
96+
{
97+
std::visit(
98+
auxiliary::overloaded{
99+
[](detail::OneTimeTask<void> &task) { std::move(task)(); },
100+
[](detail::CachedValue<void> &) { return; }},
100101
this->m_task);
101102
}
102103

0 commit comments

Comments
 (0)