Commit 7f011f0b authored by Dominik Charousset's avatar Dominik Charousset

use namespace std in hello world example

parent f67517fb
...@@ -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 std::string& 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(std::string(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 std::string& what) { on_arg_match >> [](const string& what) {
// prints "!dlroW olleH" // prints "!dlroW olleH"
aout << what << std::endl; aout << what << endl;
} }
); );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment