mirror of
https://github.com/NixOS/nix.git
synced 2025-11-19 08:49:35 +01:00
Remove comparator.hh and switch to <=> in a bunch of places
Known behavior changes: - `MemorySourceAccessor`'s comparison operators no longer forget to compare the `SourceAccessor` base class. Progress on #10832 What remains for that issue is hopefully much easier!
This commit is contained in:
parent
2a95a2d780
commit
bc83b9dc1f
49 changed files with 300 additions and 271 deletions
|
|
@ -8,7 +8,6 @@
|
|||
#include "repair-flag.hh"
|
||||
#include "derived-path-map.hh"
|
||||
#include "sync.hh"
|
||||
#include "comparator.hh"
|
||||
#include "variant-wrapper.hh"
|
||||
|
||||
#include <map>
|
||||
|
|
@ -32,7 +31,8 @@ struct DerivationOutput
|
|||
{
|
||||
StorePath path;
|
||||
|
||||
GENERATE_CMP(InputAddressed, me->path);
|
||||
bool operator == (const InputAddressed &) const = default;
|
||||
auto operator <=> (const InputAddressed &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +56,8 @@ struct DerivationOutput
|
|||
*/
|
||||
StorePath path(const StoreDirConfig & store, std::string_view drvName, OutputNameView outputName) const;
|
||||
|
||||
GENERATE_CMP(CAFixed, me->ca);
|
||||
bool operator == (const CAFixed &) const = default;
|
||||
auto operator <=> (const CAFixed &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -76,7 +77,8 @@ struct DerivationOutput
|
|||
*/
|
||||
HashAlgorithm hashAlgo;
|
||||
|
||||
GENERATE_CMP(CAFloating, me->method, me->hashAlgo);
|
||||
bool operator == (const CAFloating &) const = default;
|
||||
auto operator <=> (const CAFloating &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -84,7 +86,8 @@ struct DerivationOutput
|
|||
* isn't known yet.
|
||||
*/
|
||||
struct Deferred {
|
||||
GENERATE_CMP(Deferred);
|
||||
bool operator == (const Deferred &) const = default;
|
||||
auto operator <=> (const Deferred &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -103,7 +106,8 @@ struct DerivationOutput
|
|||
*/
|
||||
HashAlgorithm hashAlgo;
|
||||
|
||||
GENERATE_CMP(Impure, me->method, me->hashAlgo);
|
||||
bool operator == (const Impure &) const = default;
|
||||
auto operator <=> (const Impure &) const = default;
|
||||
};
|
||||
|
||||
typedef std::variant<
|
||||
|
|
@ -116,7 +120,8 @@ struct DerivationOutput
|
|||
|
||||
Raw raw;
|
||||
|
||||
GENERATE_CMP(DerivationOutput, me->raw);
|
||||
bool operator == (const DerivationOutput &) const = default;
|
||||
auto operator <=> (const DerivationOutput &) const = default;
|
||||
|
||||
MAKE_WRAPPER_CONSTRUCTOR(DerivationOutput);
|
||||
|
||||
|
|
@ -177,7 +182,8 @@ struct DerivationType {
|
|||
*/
|
||||
bool deferred;
|
||||
|
||||
GENERATE_CMP(InputAddressed, me->deferred);
|
||||
bool operator == (const InputAddressed &) const = default;
|
||||
auto operator <=> (const InputAddressed &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -201,7 +207,8 @@ struct DerivationType {
|
|||
*/
|
||||
bool fixed;
|
||||
|
||||
GENERATE_CMP(ContentAddressed, me->sandboxed, me->fixed);
|
||||
bool operator == (const ContentAddressed &) const = default;
|
||||
auto operator <=> (const ContentAddressed &) const = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -211,7 +218,8 @@ struct DerivationType {
|
|||
* type, but has some restrictions on its usage.
|
||||
*/
|
||||
struct Impure {
|
||||
GENERATE_CMP(Impure);
|
||||
bool operator == (const Impure &) const = default;
|
||||
auto operator <=> (const Impure &) const = default;
|
||||
};
|
||||
|
||||
typedef std::variant<
|
||||
|
|
@ -222,7 +230,8 @@ struct DerivationType {
|
|||
|
||||
Raw raw;
|
||||
|
||||
GENERATE_CMP(DerivationType, me->raw);
|
||||
bool operator == (const DerivationType &) const = default;
|
||||
auto operator <=> (const DerivationType &) const = default;
|
||||
|
||||
MAKE_WRAPPER_CONSTRUCTOR(DerivationType);
|
||||
|
||||
|
|
@ -312,14 +321,9 @@ struct BasicDerivation
|
|||
|
||||
static std::string_view nameFromPath(const StorePath & storePath);
|
||||
|
||||
GENERATE_CMP(BasicDerivation,
|
||||
me->outputs,
|
||||
me->inputSrcs,
|
||||
me->platform,
|
||||
me->builder,
|
||||
me->args,
|
||||
me->env,
|
||||
me->name);
|
||||
bool operator == (const BasicDerivation &) const = default;
|
||||
// TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
|
||||
//auto operator <=> (const BasicDerivation &) const = default;
|
||||
};
|
||||
|
||||
class Store;
|
||||
|
|
@ -377,9 +381,9 @@ struct Derivation : BasicDerivation
|
|||
const nlohmann::json & json,
|
||||
const ExperimentalFeatureSettings & xpSettings = experimentalFeatureSettings);
|
||||
|
||||
GENERATE_CMP(Derivation,
|
||||
static_cast<const BasicDerivation &>(*me),
|
||||
me->inputDrvs);
|
||||
bool operator == (const Derivation &) const = default;
|
||||
// TODO libc++ 16 (used by darwin) missing `std::map::operator <=>`, can't do yet.
|
||||
//auto operator <=> (const Derivation &) const = default;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue