mirror of
https://github.com/boostorg/cobalt.git
synced 2026-01-19 04:02:16 +00:00
19 lines
379 B
Plaintext
19 lines
379 B
Plaintext
[#design:promise]
|
|
== Promise
|
|
|
|
The main coroutine type is a `promise`, which is eager.
|
|
The reason to default to this, is that the compiler can optimize out
|
|
promises that do not suspend, like this:
|
|
|
|
[source,cpp]
|
|
----
|
|
cobalt::promise<void> noop()
|
|
{
|
|
co_return;
|
|
}
|
|
----
|
|
|
|
Awaiting the above operation is in theory a noop,
|
|
but practically speaking, compilers aren't there as of 2023.
|
|
|