mastodonien.de

mas.to

Zeitpunkt              Nutzer    Delta   Tröts        TNR     Titel                     Version  maxTL
Do 25.07.2024 00:00:19   175.089     +37    8.642.185    49,4 mas.to                    4.2.10     500
Mi 24.07.2024 00:01:42   175.052     +40    8.629.393    49,3 mas.to                    4.2.10     500
Di 23.07.2024 00:01:07   175.012     +46    8.616.999    49,2 mas.to                    4.2.10     500
Mo 22.07.2024 00:03:27   174.966     +26    8.604.863    49,2 mas.to                    4.2.10     500
So 21.07.2024 00:00:59   174.940     +19    8.593.986    49,1 mas.to                    4.2.10     500
Sa 20.07.2024 00:04:58   174.921     +14    8.584.355    49,1 mas.to                    4.2.10     500
Fr 19.07.2024 13:58:55   174.907     +60    8.577.227    49,0 mas.to                    4.2.10     500
Do 18.07.2024 00:03:55   174.847     +32    8.560.039    49,0 mas.to                    4.2.10     500
Mi 17.07.2024 00:00:05   174.815     +47    8.549.859    48,9 mas.to                    4.2.10     500
Di 16.07.2024 00:03:53   174.768       0    8.539.050    48,9 mas.to                    4.2.10     500

Do 25.07.2024 20:35

constexpr coroutines?

C++ snippet showcasing coroutine evaluated in constexpr interpreter and not in runtime.

Code is:
struct get_value_without_suspend: std::suspend_never {
  int value;
  
  constexpr int await_resume() const noexcept {
    return value;
  }
};

constexpr auto hana_coroutine() -> multiplying_task<int> { 
  // default internal value is `1`
  int value = co_await get_value_without_suspending{.value = 2};
  // each yield multiply internal value by itself
  co_yield 3;
  co_yield 5;
  // return too
  co_return value * 7;
}

constexpr int result = hana_coroutine().get_result();

static_assert(result == 2*3*5*7);

C++ snippet showcasing coroutine evaluated in constexpr interpreter and not in runtime. Code is: struct get_value_without_suspend: std::suspend_never { int value; constexpr int await_resume() const noexcept { return value; } }; constexpr auto hana_coroutine() -> multiplying_task { // default internal value is `1` int value = co_await get_value_without_suspending{.value = 2}; // each yield multiply internal value by itself co_yield 3; co_yield 5; // return too co_return value * 7; } constexpr int result = hana_coroutine().get_result(); static_assert(result == 2*3*5*7);

[Öffentlich] Antw.: 0 Wtrl.: 0 Fav.: 0 · via Web

Antw. · Weiterl. · Fav. · Lesez. · Pin · Stumm · Löschen