1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 03:39:36 +01:00

Get rid of std::shared_ptr<std::string> and ref<std::string>

These were needed back in the pre-C++11 era because we didn't have
move semantics. But now we do.
This commit is contained in:
Eelco Dolstra 2022-01-17 22:20:05 +01:00
parent 52ee7ec002
commit d62a9390fc
33 changed files with 138 additions and 134 deletions

View file

@ -28,7 +28,7 @@ struct NarMember
struct NarAccessor : public FSAccessor
{
std::shared_ptr<const std::string> nar;
std::optional<const std::string> nar;
GetNarBytes getNarBytes;
@ -104,7 +104,7 @@ struct NarAccessor : public FSAccessor
}
};
NarAccessor(ref<const std::string> nar) : nar(nar)
NarAccessor(std::string && _nar) : nar(_nar)
{
StringSource source(*nar);
NarIndexer indexer(*this, source);
@ -224,9 +224,9 @@ struct NarAccessor : public FSAccessor
}
};
ref<FSAccessor> makeNarAccessor(ref<const std::string> nar)
ref<FSAccessor> makeNarAccessor(std::string && nar)
{
return make_ref<NarAccessor>(nar);
return make_ref<NarAccessor>(std::move(nar));
}
ref<FSAccessor> makeNarAccessor(Source & source)