mirror of
https://github.com/NixOS/nix.git
synced 2025-12-14 21:11:04 +01:00
Make it hard to construct an empty OutputsSpec::Names
This should be a non-empty set, and so we don't want people doing this by accident. We remove the zero-0 constructor with a little inheritance trickery.
This commit is contained in:
parent
8a3b1b7ced
commit
114a6e2b09
7 changed files with 26 additions and 11 deletions
|
|
@ -8,7 +8,22 @@
|
|||
|
||||
namespace nix {
|
||||
|
||||
typedef std::set<std::string> OutputNames;
|
||||
struct OutputNames : std::set<std::string> {
|
||||
using std::set<std::string>::set;
|
||||
|
||||
// These need to be "inherited manually"
|
||||
OutputNames(const std::set<std::string> & s)
|
||||
: std::set<std::string>(s)
|
||||
{ }
|
||||
OutputNames(std::set<std::string> && s)
|
||||
: std::set<std::string>(s)
|
||||
{ }
|
||||
|
||||
/* This set should always be non-empty, so we delete this
|
||||
constructor in order make creating empty ones by mistake harder.
|
||||
*/
|
||||
OutputNames() = delete;
|
||||
};
|
||||
|
||||
struct AllOutputs {
|
||||
bool operator < (const AllOutputs & _) const { return false; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue