Language
C++
Compiler
gcc HEAD 13.0.0 20221210 (experimental)
Options
Warnings
Don't Use Boost
C++2a(GNU)
no pedantic
$ g++ prog.cc -Wall -Wextra -std=gnu++2a
main: wait 150ms for task1
FuncAsync(1): begin
FuncAsync(2): begin
FuncAsync(3): begin
FuncAsync(1): 1
FuncAsync(2): 1
FuncAsync(3): 1
FuncAsync(1): 2
FuncAsync(2): 2
FuncAsync(3): 2
main: wait for task2
FuncAsync(1): 3
FuncAsync(2): 3
FuncAsync(3): 3
FuncAsync(1): end
FuncAsync(2): end
main: task1 is ready
main: task2 is ready
main: task3 is not ready
----------
main: fib5 = 5
main: fib10 = 55
main: fib15 = 610
----------
main: pi = 3.14159
main: e = 2.71828
----------
FuncAsync(4): begin
FuncAsync(4): 1
FuncAsync(4): 2
FuncAsync(4): 3
FuncAsync(4): end
main: WhenAll result: { 42, Hello }
FuncAsync(5): begin
main: t2 was done first in WhenAny(t0, t1, t2)
main: WhenAny result: Good-bye
Exit Code:
0