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
9b8ed31d
Commit
9b8ed31d
authored
Nov 07, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use string for s_last_line rather than any_tuple
parent
6bad5f98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
16 deletions
+9
-16
examples/remote_actors/group_chat.cpp
examples/remote_actors/group_chat.cpp
+9
-16
No files found.
examples/remote_actors/group_chat.cpp
View file @
9b8ed31d
...
...
@@ -11,11 +11,9 @@
#include <set>
#include <map>
#include <vector>
#include <dlfcn.h>
#include <iostream>
#include <sstream>
#include <time.h>
#include <cstdlib>
#include <sstream>
#include <iostream>
#include "cppa/opt.hpp"
#include "cppa/cppa.hpp"
...
...
@@ -31,17 +29,17 @@ istream& operator>>(istream& is, line& l) {
return
is
;
}
any_tuple
s_last_line
;
string
s_last_line
;
any_tuple
split_line
(
const
line
&
l
)
{
vector
<
string
>
result
;
s
tringstream
strs
(
l
.
str
);
istringstream
strs
(
l
.
str
)
;
s
_last_line
=
move
(
l
.
str
);
string
tmp
;
vector
<
string
>
result
;
while
(
getline
(
strs
,
tmp
,
' '
))
{
if
(
!
tmp
.
empty
())
result
.
push_back
(
std
::
move
(
tmp
));
}
s_last_line
=
any_tuple
::
view
(
std
::
move
(
result
));
return
s_last_line
;
return
any_tuple
::
view
(
std
::
move
(
result
));
}
class
client
:
public
event_based_actor
{
...
...
@@ -152,13 +150,8 @@ int main(int argc, char** argv) {
" /help print this text
\n
"
<<
flush
;
},
others
()
>>
[
&
]
{
if
(
s_last_line
.
size
()
>
0
)
{
string
msg
=
s_last_line
.
get_as
<
string
>
(
0
);
for
(
size_t
i
=
1
;
i
<
s_last_line
.
size
();
++
i
)
{
msg
+=
" "
;
msg
+=
s_last_line
.
get_as
<
string
>
(
i
);
}
send
(
client_actor
,
atom
(
"broadcast"
),
msg
);
if
(
!
s_last_line
.
empty
())
{
send
(
client_actor
,
atom
(
"broadcast"
),
s_last_line
);
}
}
);
...
...
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