Skip to content

Commit

Permalink
Fix implementation of join
Browse files Browse the repository at this point in the history
And avoid the use of std::next, which is C++11
  • Loading branch information
giacomini committed May 23, 2024
1 parent 1947b5f commit a6ab24a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/api/ccapi/voms_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,17 @@ static std::vector<std::string> split(std::string const& source, char delim)

static std::string join(std::vector<std::string> const& v, char delim)
{
std::vector<std::string>::const_iterator it = v.begin();
std::vector<std::string>::const_iterator const end = v.end();

std::string result;

if (!v.empty()) {
result = v.front();
if (it != end) {
result += *it;
++it;
}

for (std::vector<std::string>::const_iterator it = std::next(v.begin()), end = v.end();
it != end; ++it)
for (; it != end; ++it)
{
result += delim;
result += *it;
Expand Down

0 comments on commit a6ab24a

Please sign in to comment.