diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-11 11:54:43 -0500 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2023-01-11 19:08:19 -0500 |
commit | 114a6e2b09eda7f23e7776e1cdf77715044e073e (patch) | |
tree | 34a3a255f4543925fff023160bde3789b8071e64 /src/libstore/outputs-spec.hh | |
parent | 8a3b1b7ced3e00d29a0274dde110801dea4a1e0e (diff) |
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.
Diffstat (limited to 'src/libstore/outputs-spec.hh')
-rw-r--r-- | src/libstore/outputs-spec.hh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libstore/outputs-spec.hh b/src/libstore/outputs-spec.hh index e81695da9..9c477ee2b 100644 --- a/src/libstore/outputs-spec.hh +++ b/src/libstore/outputs-spec.hh @@ -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; } |