Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-xt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ag-ohlberger
dune-community
dune-xt
Commits
233624b5
Commit
233624b5
authored
12 years ago
by
René Fritze
Browse files
Options
Downloads
Patches
Plain Diff
[string] fixes non-string tokenizer
parent
7b2c0d96
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/stuff/common/string.hh
+16
-1
16 additions, 1 deletion
dune/stuff/common/string.hh
with
16 additions
and
1 deletion
dune/stuff/common/string.hh
+
16
−
1
View file @
233624b5
...
@@ -95,11 +95,26 @@ inline std::vector<T>
...
@@ -95,11 +95,26 @@ inline std::vector<T>
tokenize
(
const
std
::
string
&
msg
,
const
std
::
string
&
seperators
,
tokenize
(
const
std
::
string
&
msg
,
const
std
::
string
&
seperators
,
const
boost
::
algorithm
::
token_compress_mode_type
mode
=
boost
::
algorithm
::
token_compress_off
)
const
boost
::
algorithm
::
token_compress_mode_type
mode
=
boost
::
algorithm
::
token_compress_off
)
{
{
std
::
vector
<
T
>
strings
;
std
::
vector
<
std
::
string
>
strings
;
boost
::
algorithm
::
split
(
strings
,
msg
,
boost
::
algorithm
::
is_any_of
(
seperators
),
mode
);
std
::
vector
<
T
>
ret
(
strings
.
size
());
size_t
i
=
0
;
// special case for empty strings to avoid non-default init
std
::
generate
(
std
::
begin
(
ret
),
std
::
end
(
ret
),
[
&
]()
{
return
strings
[
i
++
].
empty
()
?
T
()
:
convertFrom
<
T
>
(
strings
[
i
-
1
]);
});
return
ret
;
}
template
<
>
inline
std
::
vector
<
std
::
string
>
tokenize
(
const
std
::
string
&
msg
,
const
std
::
string
&
seperators
,
const
boost
::
algorithm
::
token_compress_mode_type
mode
)
{
std
::
vector
<
std
::
string
>
strings
;
boost
::
algorithm
::
split
(
strings
,
msg
,
boost
::
algorithm
::
is_any_of
(
seperators
),
mode
);
boost
::
algorithm
::
split
(
strings
,
msg
,
boost
::
algorithm
::
is_any_of
(
seperators
),
mode
);
return
strings
;
return
strings
;
}
}
//! returns string with local time in current locale's format
inline
std
::
string
fromTime
(
time_t
cur_time
=
time
(
NULL
))
inline
std
::
string
fromTime
(
time_t
cur_time
=
time
(
NULL
))
{
{
return
ctime
(
&
cur_time
);
return
ctime
(
&
cur_time
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment