Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository 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
savoirfairelinux
jami-daemon
Commits
ae76d0c3
Commit
ae76d0c3
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
string_utils: don't copy set in string_join, use {fmt}
Change-Id: Ibab897b53868091e55f092ccf1bc9a016de467b6
parent
3df31d22
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/string_utils.cpp
+3
-7
3 additions, 7 deletions
src/string_utils.cpp
src/string_utils.h
+1
-1
1 addition, 1 deletion
src/string_utils.h
with
4 additions
and
8 deletions
src/string_utils.cpp
+
3
−
7
View file @
ae76d0c3
...
...
@@ -22,6 +22,7 @@
#include
"string_utils.h"
#include
<fmt/core.h>
#include
<fmt/ranges.h>
#include
<sstream>
#include
<cctype>
...
...
@@ -146,14 +147,9 @@ string_remove_suffix(std::string_view str, char separator)
}
std
::
string
string_join
(
std
::
set
<
std
::
string
>
set
,
std
::
string_view
separator
)
string_join
(
const
std
::
set
<
std
::
string
>
&
set
,
std
::
string_view
separator
)
{
if
(
set
.
empty
())
return
""
;
std
::
string
output
;
for
(
const
auto
&
s
:
set
)
output
+=
s
+
separator
;
return
output
;
return
fmt
::
format
(
"{}"
,
fmt
::
join
(
set
,
separator
));
}
std
::
set
<
std
::
string
>
...
...
This diff is collapsed.
Click to expand it.
src/string_utils.h
+
1
−
1
View file @
ae76d0c3
...
...
@@ -178,7 +178,7 @@ void string_replace(std::string& str, const std::string& from, const std::string
std
::
string_view
string_remove_suffix
(
std
::
string_view
str
,
char
separator
);
std
::
string
string_join
(
std
::
set
<
std
::
string
>
set
,
std
::
string_view
separator
=
"/"
);
std
::
string
string_join
(
const
std
::
set
<
std
::
string
>
&
set
,
std
::
string_view
separator
=
"/"
);
std
::
set
<
std
::
string
>
string_split_set
(
std
::
string
&
str
,
std
::
string_view
separator
=
"/"
);
...
...
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