From 76e88871b21c47c0216e160a5fb926f763ba64fe Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Sep 2012 15:43:23 -0400 Subject: Templatise tokenizeString() --- src/libutil/util.cc | 7 +++++-- src/libutil/util.hh | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src/libutil') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 56bf5875deaa..7f95d398147f 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -984,9 +984,9 @@ void _interrupted() ////////////////////////////////////////////////////////////////////// -Strings tokenizeString(const string & s, const string & separators) +template C tokenizeString(const string & s, const string & separators) { - Strings result; + C result; string::size_type pos = s.find_first_not_of(separators, 0); while (pos != string::npos) { string::size_type end = s.find_first_of(separators, pos + 1); @@ -998,6 +998,9 @@ Strings tokenizeString(const string & s, const string & separators) return result; } +template Strings tokenizeString(const string & s, const string & separators); +template vector tokenizeString(const string & s, const string & separators); + string concatStringsSep(const string & sep, const Strings & ss) { diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 0616288cd541..408d99a96e66 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -286,7 +286,7 @@ MakeError(Interrupted, BaseError) /* String tokenizer. */ -Strings tokenizeString(const string & s, const string & separators = " \t\n\r"); +template C tokenizeString(const string & s, const string & separators = " \t\n\r"); /* Concatenate the given strings with a separator between the -- cgit 1.4.1