Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tom Niget
typon
Commits
d488a468
Commit
d488a468
authored
Jun 21, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test program fibo_call_overhead.cpp
parent
75f2ce17
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
0 deletions
+26
-0
rt/test/fibo_call_overhead.cpp
rt/test/fibo_call_overhead.cpp
+26
-0
No files found.
rt/test/fibo_call_overhead.cpp
0 → 100644
View file @
d488a468
#include <typon/core/task.hpp>
#include <cstdio>
using
namespace
typon
;
template
<
typename
T
>
Task
<
typename
T
::
promise_type
::
value_type
>
call
(
T
task
)
{
co_return
co_await
std
::
move
(
task
);
}
Task
<
int
>
fibo
(
int
n
)
{
if
(
n
<
2
)
{
co_return
n
;
}
int
a
=
co_await
call
(
fibo
(
n
-
1
));
int
b
=
co_await
call
(
fibo
(
n
-
2
));
co_return
a
+
b
;
}
int
main
()
{
int
result
=
fibo
(
40
).
call
();
printf
(
"%d
\n
"
,
result
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment