#include "derived-path-map.hh" namespace nix { template typename DerivedPathMap::ChildNode & DerivedPathMap::ensureSlot(const SingleDerivedPath & k) { std::function initIter; initIter = [&](const auto & k) -> auto & { return std::visit(overloaded { [&](const SingleDerivedPath::Opaque & bo) -> auto & { // will not overwrite if already there return map[bo.path]; }, [&](const SingleDerivedPath::Built & bfd) -> auto & { auto & n = initIter(*bfd.drvPath); return n.childMap[bfd.output]; }, }, k.raw()); }; return initIter(k); } template typename DerivedPathMap::ChildNode * DerivedPathMap::findSlot(const SingleDerivedPath & k) { std::function initIter; initIter = [&](const auto & k) { return std::visit(overloaded { [&](const SingleDerivedPath::Opaque & bo) { auto it = map.find(bo.path); return it != map.end() ? &it->second : nullptr; }, [&](const SingleDerivedPath::Built & bfd) { auto * n = initIter(*bfd.drvPath); if (!n) return (ChildNode *)nullptr; auto it = n->childMap.find(bfd.output); return it != n->childMap.end() ? &it->second : nullptr; }, }, k.raw()); }; return initIter(k); } } // instantiations #include "create-derivation-and-realise-goal.hh" namespace nix { template struct DerivedPathMap>; GENERATE_CMP_EXT( template<>, DerivedPathMap>::ChildNode, me->value, me->childMap); GENERATE_CMP_EXT( template<>, DerivedPathMap>, me->map); template struct DerivedPathMap>; };