Fixed compilation problem on some platforms.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3080 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
d3960d810c
commit
7e03777aa1
@ -73,29 +73,6 @@ namespace StringUtils
|
||||
std::string downcase (const std::string&);
|
||||
std::vector<std::string> split(const std::string& s, char c);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Overloaded insert_values taking one value, see below for
|
||||
* full docs.
|
||||
* \param s String in which all %s or %d are replaced.
|
||||
* \param v1 Value to replace.
|
||||
*/
|
||||
template <class T1>
|
||||
std::string insert_values(const std::string &s, const T1 &v1)
|
||||
{
|
||||
return insert_values(s, v1, "", "");
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Overloaded insert_values taking two values, see below for
|
||||
* full docs.
|
||||
* \param s String in which all %s or %d are replaced.
|
||||
* \param v1,v2 Value(s) to replace all %s or %d with.
|
||||
*/
|
||||
template <class T1, class T2>
|
||||
std::string insert_values(const std::string &s, const T1 &v1,
|
||||
const T2 &v2=0)
|
||||
{
|
||||
return insert_values(s, v1, v2, "");
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Replaces the first %s or %d in the string with the first value
|
||||
* converted to a string), the 2nd %s or %d with the second value etc.
|
||||
@ -115,7 +92,7 @@ namespace StringUtils
|
||||
*/
|
||||
template <class T1, class T2, class T3>
|
||||
std::string insert_values(const std::string &s, const T1 &v1,
|
||||
const T2 &v2=0, const T3 &v3=0)
|
||||
const T2 &v2, const T3 &v3)
|
||||
{
|
||||
std::vector<std::string> all_vals;
|
||||
std::ostringstream dummy;
|
||||
@ -138,6 +115,31 @@ namespace StringUtils
|
||||
return new_string;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// Note: the order in which the templates are specified is important, since
|
||||
// otherwise some compilers will not find the right template to use.
|
||||
/** Overloaded insert_values taking two values, see below for
|
||||
* full docs.
|
||||
* \param s String in which all %s or %d are replaced.
|
||||
* \param v1,v2 Value(s) to replace all %s or %d with.
|
||||
*/
|
||||
template <class T1, class T2>
|
||||
std::string insert_values(const std::string &s, const T1 &v1,
|
||||
const T2 &v2)
|
||||
{
|
||||
return insert_values(s, v1, v2, "");
|
||||
}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Overloaded insert_values taking one value, see below for
|
||||
* full docs.
|
||||
* \param s String in which all %s or %d are replaced.
|
||||
* \param v1 Value to replace.
|
||||
*/
|
||||
template <class T1>
|
||||
std::string insert_values(const std::string &s, const T1 &v1)
|
||||
{
|
||||
return insert_values(s, v1, "", "");
|
||||
}
|
||||
} // namespace StringUtils
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user