From c23d09f65084e6088111dc974f0e290b042de89d Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 12 Jun 2013 19:30:15 +0200 Subject: Simplify stringjoiner: take 1 parameter, join from begin() to end() and use space as the sep char --- src/hashcomp.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/hashcomp.cpp') diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 06b3ce669..3f3754884 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -397,14 +397,14 @@ int irc::modestacker::GetStackedLine(std::vector &result, int max_l return n; } -irc::stringjoiner::stringjoiner(const std::string& separator, const std::vector& sequence, unsigned int begin, unsigned int end) +irc::stringjoiner::stringjoiner(const std::vector& sequence) { - if (end < begin) + if (sequence.empty()) return; // nothing to do here - for (unsigned int v = begin; v < end; v++) - joined.append(sequence[v]).append(separator); - joined.append(sequence[end]); + for (std::vector::const_iterator i = sequence.begin(); i != sequence.end(); ++i) + joined.append(*i).push_back(' '); + joined.erase(joined.end()-1); } irc::portparser::portparser(const std::string &source, bool allow_overlapped) -- cgit v1.3.1-10-gc9f91