make nodes to provide nodes instead of mixins
This commit is contained in:
@@ -5,10 +5,14 @@
|
||||
template <class TElem>
|
||||
class OneToOneLink : public BaseLink<TElem> {
|
||||
public:
|
||||
OneToOneLink(std::shared_ptr<TElem> e) : BaseLink<TElem>(e) {}
|
||||
void addChild(const std::shared_ptr<TElem>& child) override {
|
||||
using ElemPtr = std::shared_ptr<TElem>;
|
||||
|
||||
OneToOneLink(ElemPtr e) : BaseLink<TElem>(e) {}
|
||||
|
||||
void addChild(const ElemPtr& child) override {
|
||||
if (!this->children_.empty())
|
||||
throw std::logic_error("OneToOneLink cannot have more than one child");
|
||||
throw std::logic_error("Too many children");
|
||||
|
||||
BaseLink<TElem>::addChild(child);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user