From: Mikko Rasa Date: Wed, 28 Dec 2022 11:43:23 +0000 (+0200) Subject: Disallow two components with the same name X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=0d5c6844672227a4b1b3eaa3161493d46eb06a96;p=builder.git Disallow two components with the same name --- diff --git a/source/lib/sourcepackage.cpp b/source/lib/sourcepackage.cpp index 0913592..34e8a1b 100644 --- a/source/lib/sourcepackage.cpp +++ b/source/lib/sourcepackage.cpp @@ -219,6 +219,8 @@ void SourcePackage::Loader::feature(const string &n, const string &d) template void SourcePackage::Loader::component(Args... args, const string &n) { + if(any_of(obj.components.begin(), obj.components.end(), [&n](const Component *c){ return c->get_name()==n; })) + throw key_error(n); C *comp = new C(obj, n, args...); load_sub(*comp); obj.components.push_back(comp);