mirror of
https://github.com/NixOS/nix
synced 2025-06-27 04:21:16 +02:00
* Templatise getIntArg / string2Int.
This commit is contained in:
parent
8022015552
commit
9b8fda796b
5 changed files with 25 additions and 40 deletions
|
@ -1055,22 +1055,6 @@ string int2String(int n)
|
|||
}
|
||||
|
||||
|
||||
bool string2Int(const string & s, int & n)
|
||||
{
|
||||
std::istringstream str(s);
|
||||
str >> n;
|
||||
return str && str.get() == EOF;
|
||||
}
|
||||
|
||||
|
||||
bool string2Int(const string & s, long long & n)
|
||||
{
|
||||
std::istringstream str(s);
|
||||
str >> n;
|
||||
return str && str.get() == EOF;
|
||||
}
|
||||
|
||||
|
||||
bool hasSuffix(const string & s, const string & suffix)
|
||||
{
|
||||
return s.size() >= suffix.size() && string(s, s.size() - suffix.size()) == suffix;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue