use more classical approach to function template instantiation
This commit is contained in:
parent
700a408947
commit
3b6870f133
@ -281,21 +281,12 @@ template <class T> bool stringToStrings(const string &s, T &tokens,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool stringToStrings(const string &s, list<string> &tokens,
|
template bool stringToStrings<list<string> >(const string &,
|
||||||
const string& as)
|
list<string> &, const string&);
|
||||||
{
|
template bool stringToStrings<vector<string> >(const string &,
|
||||||
return stringToStrings<list<string> >(s, tokens, as);
|
vector<string> &,const string&);
|
||||||
}
|
template bool stringToStrings<set<string> >(const string &,
|
||||||
bool stringToStrings(const string &s, vector<string> &tokens,
|
set<string> &, const string&);
|
||||||
const string& as)
|
|
||||||
{
|
|
||||||
return stringToStrings<vector<string> >(s, tokens, as);
|
|
||||||
}
|
|
||||||
bool stringToStrings(const string &s, set<string> &tokens,
|
|
||||||
const string& as)
|
|
||||||
{
|
|
||||||
return stringToStrings<set<string> >(s, tokens, as);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T> void stringsToString(const T &tokens, string &s)
|
template <class T> void stringsToString(const T &tokens, string &s)
|
||||||
{
|
{
|
||||||
@ -321,18 +312,9 @@ template <class T> void stringsToString(const T &tokens, string &s)
|
|||||||
s.append(1, '"');
|
s.append(1, '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void stringsToString(const list<string> &tokens, string &s)
|
template void stringsToString<list<string> >(const list<string> &, string &);
|
||||||
{
|
template void stringsToString<vector<string> >(const vector<string> &,string &);
|
||||||
stringsToString<list<string> >(tokens, s);
|
template void stringsToString<set<string> >(const set<string> &, string &);
|
||||||
}
|
|
||||||
void stringsToString(const vector<string> &tokens, string &s)
|
|
||||||
{
|
|
||||||
stringsToString<vector<string> >(tokens, s);
|
|
||||||
}
|
|
||||||
void stringsToString(const set<string> &tokens, string &s)
|
|
||||||
{
|
|
||||||
stringsToString<set<string> >(tokens, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void stringToTokens(const string& str, vector<string>& tokens,
|
void stringToTokens(const string& str, vector<string>& tokens,
|
||||||
const string& delims, bool skipinit)
|
const string& delims, bool skipinit)
|
||||||
@ -499,7 +481,7 @@ string escapeShell(const string &in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Small utility to substitute printf-like percents cmds in a string
|
// Substitute printf-like percent cmds inside a string
|
||||||
bool pcSubst(const string& in, string& out, map<char, string>& subs)
|
bool pcSubst(const string& in, string& out, map<char, string>& subs)
|
||||||
{
|
{
|
||||||
string::const_iterator it;
|
string::const_iterator it;
|
||||||
|
|||||||
@ -47,8 +47,10 @@ struct StringIcmpPred {
|
|||||||
|
|
||||||
extern int stringlowercmp(const string& alreadylower, const string& s2);
|
extern int stringlowercmp(const string& alreadylower, const string& s2);
|
||||||
extern int stringuppercmp(const string& alreadyupper, const string& s2);
|
extern int stringuppercmp(const string& alreadyupper, const string& s2);
|
||||||
|
|
||||||
extern void stringtolower(string& io);
|
extern void stringtolower(string& io);
|
||||||
extern string stringtolower(const string& io);
|
extern string stringtolower(const string& io);
|
||||||
|
|
||||||
// Is one string the end part of the other ?
|
// Is one string the end part of the other ?
|
||||||
extern int stringisuffcmp(const string& s1, const string& s2);
|
extern int stringisuffcmp(const string& s1, const string& s2);
|
||||||
|
|
||||||
@ -69,8 +71,8 @@ extern bool samecharset(const string &cs1, const string &cs2);
|
|||||||
struct DateInterval {
|
struct DateInterval {
|
||||||
int y1;int m1;int d1; int y2;int m2;int d2;
|
int y1;int m1;int d1; int y2;int m2;int d2;
|
||||||
};
|
};
|
||||||
bool parsedateinterval(const string&s, DateInterval *di);
|
extern bool parsedateinterval(const string&s, DateInterval *di);
|
||||||
int monthdays(int mon, int year);
|
extern int monthdays(int mon, int year);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse input string into list of strings.
|
* Parse input string into list of strings.
|
||||||
@ -82,19 +84,13 @@ int monthdays(int mon, int year);
|
|||||||
* but so are the iso-8859-x and surely others. addseps do have to be
|
* but so are the iso-8859-x and surely others. addseps do have to be
|
||||||
* single-bytes
|
* single-bytes
|
||||||
*/
|
*/
|
||||||
extern bool stringToStrings(const string& s, list<string> &tokens,
|
template <class T> bool stringToStrings(const string& s, T &tokens,
|
||||||
const string& addseps = "");
|
const string& addseps = "");
|
||||||
extern bool stringToStrings(const string& s, vector<string> &tokens,
|
|
||||||
const string& addseps = "");
|
|
||||||
extern bool stringToStrings(const string& s, set<string> &tokens,
|
|
||||||
const string& addseps = "");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inverse operation:
|
* Inverse operation:
|
||||||
*/
|
*/
|
||||||
extern void stringsToString(const list<string> &tokens, string &s);
|
template <class T> void stringsToString(const T &tokens, string &s);
|
||||||
extern void stringsToString(const vector<string> &tokens, string &s);
|
|
||||||
extern void stringsToString(const set<string> &tokens, string &s);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Split input string. No handling of quoting
|
* Split input string. No handling of quoting
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user