@@ -342,40 +342,14 @@ class [[nodiscard]] AwaitableScalar
342
342
std::promise<T> _promise;
343
343
};
344
344
345
- [[nodiscard]] bool await_ready () const noexcept
345
+ [[nodiscard ( " unexpected call " )]] constexpr bool await_ready () const noexcept
346
346
{
347
- return std::visit (
348
- [](const auto & value) noexcept {
349
- using value_type = std::decay_t <decltype (value)>;
350
-
351
- if constexpr (std::is_same_v<value_type, T>)
352
- {
353
- return true ;
354
- }
355
- else if constexpr (std::is_same_v<value_type, std::future<T>>)
356
- {
357
- using namespace std ::literals;
358
-
359
- return value.wait_for (0s) != std::future_status::timeout;
360
- }
361
- else if constexpr (std::is_same_v<value_type,
362
- std::shared_ptr<const response::Value>>)
363
- {
364
- return true ;
365
- }
366
- },
367
- _value);
347
+ return true ;
368
348
}
369
349
370
350
void await_suspend (coro::coroutine_handle<> h) const
371
351
{
372
- std::thread (
373
- [this ](coro::coroutine_handle<> h) noexcept {
374
- std::get<std::future<T>>(_value).wait ();
375
- h.resume ();
376
- },
377
- std::move (h))
378
- .detach ();
352
+ h.resume ();
379
353
}
380
354
381
355
[[nodiscard]] T await_resume ()
@@ -695,39 +669,18 @@ class [[nodiscard]] AwaitableObject
695
669
std::promise<T> _promise;
696
670
};
697
671
698
- [[nodiscard]] bool await_ready () const noexcept
672
+ [[nodiscard ( " unexpected call " )]] constexpr bool await_ready () const noexcept
699
673
{
700
- return std::visit (
701
- [](const auto & value) noexcept {
702
- using value_type = std::decay_t <decltype (value)>;
703
-
704
- if constexpr (std::is_same_v<value_type, T>)
705
- {
706
- return true ;
707
- }
708
- else if constexpr (std::is_same_v<value_type, std::future<T>>)
709
- {
710
- using namespace std ::literals;
711
-
712
- return value.wait_for (0s) != std::future_status::timeout;
713
- }
714
- },
715
- _value);
674
+ return true ;
716
675
}
717
676
718
677
void await_suspend (coro::coroutine_handle<> h) const
719
678
{
679
+ <<<<<<< HEAD
720
680
std::thread (
721
681
[this ](coro::coroutine_handle<> h) noexcept {
722
682
std::get<std::future<T>>(_value).wait ();
723
- h.resume ();
724
- },
725
- std::move (h))
726
- .detach ();
727
- }
728
-
729
683
[[nodiscard]] T await_resume ()
730
- {
731
684
return std::visit (
732
685
[](auto && value) -> T {
733
686
using value_type = std::decay_t <decltype (value)>;
0 commit comments