1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-28 22:01:15 +02:00

Change lock file format to use an attribute representation of flake refs rather than URLs

This commit is contained in:
Eelco Dolstra 2020-01-31 19:16:40 +01:00
parent dbefe9e6b8
commit 8414685c0f
12 changed files with 293 additions and 39 deletions

View file

@ -483,10 +483,11 @@ string base64Decode(const string & s);
/* Get a value for the specified key from an associate container, or a
default value if the key doesn't exist. */
template <class T>
std::optional<std::string> get(const T & map, const std::string & key)
std::optional<typename T::mapped_type> get(const T & map, const typename T::key_type & key)
{
auto i = map.find(key);
return i == map.end() ? std::optional<std::string>() : i->second;
if (i == map.end()) return {};
return std::optional<typename T::mapped_type>(i->second);
}