You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
454 B
C++

#pragma once
#include "links/BaseLink.h"
template <class TElem>
class OneToManyLink : public BaseLink<TElem> {
public:
OneToManyLink(std::shared_ptr<TElem> e) : BaseLink<TElem>(e) {}
void addChild(const std::shared_ptr<TElem>& child) override {
/* Each child must be exactly the same type as parent */
if (typeid(*child) != typeid(*this->owner_node_.lock()))
throw std::logic_error("Foundling child");
BaseLink<TElem>::addChild(child);
}
};