mirror of
https://github.com/NixOS/nix
synced 2025-06-29 10:31:15 +02:00
* Templatise getIntArg / string2Int.
This commit is contained in:
parent
8022015552
commit
9b8fda796b
5 changed files with 25 additions and 40 deletions
|
@ -295,9 +295,14 @@ bool statusOk(int status);
|
|||
|
||||
|
||||
/* Parse a string into an integer. */
|
||||
template<class N> bool string2Int(const string & s, N & n)
|
||||
{
|
||||
std::istringstream str(s);
|
||||
str >> n;
|
||||
return str && str.get() == EOF;
|
||||
}
|
||||
|
||||
string int2String(int n);
|
||||
bool string2Int(const string & s, int & n);
|
||||
bool string2Int(const string & s, long long & n);
|
||||
|
||||
|
||||
/* Return true iff `s' ends in `suffix'. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue