Skip to content

Commit 93777e9

Browse files
committed
avoid portability issue with msvc
1 parent 579e848 commit 93777e9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

include/exec/task.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,15 @@ namespace experimental::execution
540540
[[nodiscard]]
541541
constexpr auto disposition() const noexcept -> __task::disposition
542542
{
543-
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
544-
STDEXEC_CONSTEXPR_LOCAL __task::disposition __map[] = {__task::disposition::stopped,
545-
__task::disposition::succeeded,
546-
__task::disposition::failed};
547-
// index() returns 0 for success, 1 for error, and -1 for stopped, so add 1 to
548-
// get the correct disposition.
549-
return __map[this->__data_.index() + 1ul];
543+
switch (this->__data_.index())
544+
{
545+
case 0:
546+
return __task::disposition::succeeded;
547+
case 1:
548+
return __task::disposition::failed;
549+
default:
550+
return __task::disposition::stopped;
551+
}
550552
}
551553

552554
constexpr void unhandled_exception() noexcept

0 commit comments

Comments
 (0)