mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
Merge pull request #11843 from xokdvium/dev/move-fixes
fix(treewide): clean up move semantics
This commit is contained in:
commit
aa9c0bc1ee
9 changed files with 15 additions and 17 deletions
|
@ -26,7 +26,7 @@ struct ExtraPathInfoFlake : ExtraPathInfoValue
|
||||||
Flake flake;
|
Flake flake;
|
||||||
|
|
||||||
ExtraPathInfoFlake(Value && v, Flake && f)
|
ExtraPathInfoFlake(Value && v, Flake && f)
|
||||||
: ExtraPathInfoValue(std::move(v)), flake(f)
|
: ExtraPathInfoValue(std::move(v)), flake(std::move(f))
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct ExtraPathInfoValue : ExtraPathInfo
|
||||||
Value value;
|
Value value;
|
||||||
|
|
||||||
ExtraPathInfoValue(Value && v)
|
ExtraPathInfoValue(Value && v)
|
||||||
: value(v)
|
: value(std::move(v))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
virtual ~ExtraPathInfoValue() = default;
|
virtual ~ExtraPathInfoValue() = default;
|
||||||
|
|
|
@ -298,6 +298,10 @@ struct BasicDerivation
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
BasicDerivation() = default;
|
BasicDerivation() = default;
|
||||||
|
BasicDerivation(BasicDerivation &&) = default;
|
||||||
|
BasicDerivation(const BasicDerivation &) = default;
|
||||||
|
BasicDerivation& operator=(BasicDerivation &&) = default;
|
||||||
|
BasicDerivation& operator=(const BasicDerivation &) = default;
|
||||||
virtual ~BasicDerivation() { };
|
virtual ~BasicDerivation() { };
|
||||||
|
|
||||||
bool isBuiltin() const;
|
bool isBuiltin() const;
|
||||||
|
|
|
@ -153,7 +153,7 @@ struct curlFileTransfer : public FileTransfer
|
||||||
template<class T>
|
template<class T>
|
||||||
void fail(T && e)
|
void fail(T && e)
|
||||||
{
|
{
|
||||||
failEx(std::make_exception_ptr(std::move(e)));
|
failEx(std::make_exception_ptr(std::forward<T>(e)));
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaSink finalSink;
|
LambdaSink finalSink;
|
||||||
|
|
|
@ -33,7 +33,7 @@ Machine::Machine(
|
||||||
systemTypes(systemTypes),
|
systemTypes(systemTypes),
|
||||||
sshKey(sshKey),
|
sshKey(sshKey),
|
||||||
maxJobs(maxJobs),
|
maxJobs(maxJobs),
|
||||||
speedFactor(speedFactor == 0.0f ? 1.0f : std::move(speedFactor)),
|
speedFactor(speedFactor == 0.0f ? 1.0f : speedFactor),
|
||||||
supportedFeatures(supportedFeatures),
|
supportedFeatures(supportedFeatures),
|
||||||
mandatoryFeatures(mandatoryFeatures),
|
mandatoryFeatures(mandatoryFeatures),
|
||||||
sshPublicHostKey(sshPublicHostKey)
|
sshPublicHostKey(sshPublicHostKey)
|
||||||
|
|
|
@ -176,17 +176,18 @@ struct ValidPathInfo : UnkeyedValidPathInfo {
|
||||||
*/
|
*/
|
||||||
Strings shortRefs() const;
|
Strings shortRefs() const;
|
||||||
|
|
||||||
ValidPathInfo(const ValidPathInfo & other) = default;
|
|
||||||
|
|
||||||
ValidPathInfo(StorePath && path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(std::move(path)) { };
|
ValidPathInfo(StorePath && path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(std::move(path)) { };
|
||||||
ValidPathInfo(const StorePath & path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(path) { };
|
ValidPathInfo(const StorePath & path, UnkeyedValidPathInfo info) : UnkeyedValidPathInfo(info), path(path) { };
|
||||||
|
|
||||||
ValidPathInfo(const Store & store,
|
ValidPathInfo(const Store & store,
|
||||||
std::string_view name, ContentAddressWithReferences && ca, Hash narHash);
|
std::string_view name, ContentAddressWithReferences && ca, Hash narHash);
|
||||||
|
|
||||||
virtual ~ValidPathInfo() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static_assert(std::is_move_assignable_v<ValidPathInfo>);
|
||||||
|
static_assert(std::is_copy_assignable_v<ValidPathInfo>);
|
||||||
|
static_assert(std::is_copy_constructible_v<ValidPathInfo>);
|
||||||
|
static_assert(std::is_move_constructible_v<ValidPathInfo>);
|
||||||
|
|
||||||
using ValidPathInfos = std::map<StorePath, ValidPathInfo>;
|
using ValidPathInfos = std::map<StorePath, ValidPathInfo>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ ExecutablePath ExecutablePath::parse(const OsString & path)
|
||||||
std::make_move_iterator(strings.begin()),
|
std::make_move_iterator(strings.begin()),
|
||||||
std::make_move_iterator(strings.end()),
|
std::make_move_iterator(strings.end()),
|
||||||
std::back_inserter(ret),
|
std::back_inserter(ret),
|
||||||
[](auto && str) {
|
[](OsString && str) {
|
||||||
return fs::path{
|
return fs::path{
|
||||||
str.empty()
|
str.empty()
|
||||||
// "A zero-length prefix is a legacy feature that
|
// "A zero-length prefix is a legacy feature that
|
||||||
|
|
|
@ -9,7 +9,7 @@ Pos::Pos(const Pos * other)
|
||||||
}
|
}
|
||||||
line = other->line;
|
line = other->line;
|
||||||
column = other->column;
|
column = other->column;
|
||||||
origin = std::move(other->origin);
|
origin = other->origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pos::operator std::shared_ptr<Pos>() const
|
Pos::operator std::shared_ptr<Pos>() const
|
||||||
|
|
|
@ -18,11 +18,6 @@ private:
|
||||||
std::shared_ptr<T> p;
|
std::shared_ptr<T> p;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ref(const ref<T> & r)
|
|
||||||
: p(r.p)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
explicit ref(const std::shared_ptr<T> & p)
|
explicit ref(const std::shared_ptr<T> & p)
|
||||||
: p(p)
|
: p(p)
|
||||||
{
|
{
|
||||||
|
@ -75,8 +70,6 @@ public:
|
||||||
return ref<T2>((std::shared_ptr<T2>) p);
|
return ref<T2>((std::shared_ptr<T2>) p);
|
||||||
}
|
}
|
||||||
|
|
||||||
ref<T> & operator=(ref<T> const & rhs) = default;
|
|
||||||
|
|
||||||
bool operator == (const ref<T> & other) const
|
bool operator == (const ref<T> & other) const
|
||||||
{
|
{
|
||||||
return p == other.p;
|
return p == other.p;
|
||||||
|
|
Loading…
Reference in a new issue