1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 21:01:16 +02:00

Merge remote-tracking branch 'origin/master' into large-path-warning

This commit is contained in:
Eelco Dolstra 2024-06-03 15:32:27 +02:00
commit 7f5b57d18f
435 changed files with 6086 additions and 2767 deletions

View file

@ -5,7 +5,6 @@
#include "error.hh"
#include "logging.hh"
#include <boost/lexical_cast.hpp>
#include <functional>
#include <map>
@ -102,16 +101,7 @@ std::string rewriteStrings(std::string s, const StringMap & rewrites);
* Parse a string into an integer.
*/
template<class N>
std::optional<N> string2Int(const std::string_view s)
{
if (s.substr(0, 1) == "-" && !std::numeric_limits<N>::is_signed)
return std::nullopt;
try {
return boost::lexical_cast<N>(s.data(), s.size());
} catch (const boost::bad_lexical_cast &) {
return std::nullopt;
}
}
std::optional<N> string2Int(const std::string_view s);
/**
* Like string2Int(), but support an optional suffix 'K', 'M', 'G' or
@ -148,14 +138,7 @@ std::string renderSize(uint64_t value, bool align = false);
* Parse a string into a float.
*/
template<class N>
std::optional<N> string2Float(const std::string_view s)
{
try {
return boost::lexical_cast<N>(s.data(), s.size());
} catch (const boost::bad_lexical_cast &) {
return std::nullopt;
}
}
std::optional<N> string2Float(const std::string_view s);
/**