1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-14 21:11:04 +01:00

Assert on construction that OutputsSpec::Names is non-empty

This commit is contained in:
John Ericson 2023-01-12 20:41:29 -05:00
parent e947aa5401
commit d29eb08563
2 changed files with 12 additions and 3 deletions

View file

@ -1,5 +1,6 @@
#pragma once
#include <cassert>
#include <optional>
#include <set>
#include <variant>
@ -11,13 +12,15 @@ namespace nix {
struct OutputNames : std::set<std::string> {
using std::set<std::string>::set;
// These need to be "inherited manually"
/* These need to be "inherited manually" */
OutputNames(const std::set<std::string> & s)
: std::set<std::string>(s)
{ }
{ assert(!empty()); }
OutputNames(std::set<std::string> && s)
: std::set<std::string>(s)
{ }
{ assert(!empty()); }
/* This set should always be non-empty, so we delete this
constructor in order make creating empty ones by mistake harder.