Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
7f011f0b
Commit
7f011f0b
authored
Apr 11, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use namespace std in hello world example
parent
f67517fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
examples/hello_world.cpp
examples/hello_world.cpp
+7
-6
No files found.
examples/hello_world.cpp
View file @
7f011f0b
...
@@ -2,18 +2,19 @@
...
@@ -2,18 +2,19 @@
#include <iostream>
#include <iostream>
#include "cppa/cppa.hpp"
#include "cppa/cppa.hpp"
using
namespace
std
;
using
namespace
cppa
;
using
namespace
cppa
;
void
mirror
()
{
void
mirror
()
{
// wait for messages
// wait for messages
become
(
become
(
// invoke this lambda expression if we receive a string
// invoke this lambda expression if we receive a string
on_arg_match
>>
[](
const
st
d
::
st
ring
&
what
)
{
on_arg_match
>>
[](
const
string
&
what
)
{
// prints "Hello World!" via aout (thread-safe cout wrapper)
// prints "Hello World!" via aout (thread-safe cout wrapper)
aout
<<
what
<<
std
::
endl
;
aout
<<
what
<<
endl
;
// replies "!dlroW olleH"
// replies "!dlroW olleH"
reply
(
st
d
::
st
ring
(
what
.
rbegin
(),
what
.
rend
()));
reply
(
string
(
what
.
rbegin
(),
what
.
rend
()));
// terminates this actor (
become otherwise 'loops'
forever)
// terminates this actor (
'become' otherwise loops
forever)
self
->
quit
();
self
->
quit
();
}
}
);
);
...
@@ -23,9 +24,9 @@ void hello_world(const actor_ptr& buddy) {
...
@@ -23,9 +24,9 @@ void hello_world(const actor_ptr& buddy) {
// send "Hello World!" to our buddy ...
// send "Hello World!" to our buddy ...
sync_send
(
buddy
,
"Hello World!"
).
then
(
sync_send
(
buddy
,
"Hello World!"
).
then
(
// ... and wait for a response
// ... and wait for a response
on_arg_match
>>
[](
const
st
d
::
st
ring
&
what
)
{
on_arg_match
>>
[](
const
string
&
what
)
{
// prints "!dlroW olleH"
// prints "!dlroW olleH"
aout
<<
what
<<
std
::
endl
;
aout
<<
what
<<
endl
;
}
}
);
);
}
}
...
...
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