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
554bf7bd
Commit
554bf7bd
authored
Apr 09, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added `keep_empties` option to `split`
parent
5a8a755b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
unit_testing/test.cpp
unit_testing/test.cpp
+8
-5
unit_testing/test.hpp
unit_testing/test.hpp
+1
-1
No files found.
unit_testing/test.cpp
View file @
554bf7bd
...
...
@@ -41,10 +41,13 @@ void cppa_unexpected_timeout(const char* fname, size_t line_num) {
CPPA_PRINTERRC
(
fname
,
line_num
,
"unexpected timeout"
);
}
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
)
{
std
::
vector
<
std
::
string
>
result
;
std
::
stringstream
strs
{
str
};
std
::
string
tmp
;
while
(
std
::
getline
(
strs
,
tmp
,
delim
))
result
.
push_back
(
tmp
);
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
,
bool
keep_empties
)
{
using
namespace
std
;
vector
<
string
>
result
;
stringstream
strs
{
str
};
string
tmp
;
while
(
getline
(
strs
,
tmp
,
delim
))
{
if
(
!
tmp
.
empty
()
||
keep_empties
)
result
.
push_back
(
std
::
move
(
tmp
));
}
return
result
;
}
unit_testing/test.hpp
View file @
554bf7bd
...
...
@@ -147,6 +147,6 @@ inline void cppa_check_value(V1 v1,
#define CPPA_UNEXPECTED_MSG_CB() [] { CPPA_UNEXPECTED_MSG(); }
#define CPPA_UNEXPECTED_TOUT_CB() [] { CPPA_UNEXPECTED_TOUT(); }
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
);
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
str
,
char
delim
=
' '
,
bool
keep_empties
=
true
);
#endif // TEST_HPP
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