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.
17 lines
465 B
C++
17 lines
465 B
C++
#pragma once
|
|
#include "links/BaseLink.h"
|
|
#include <stdexcept>
|
|
|
|
/// \brief Связь для листового узла, не допускающая дочерних элементов.
|
|
template <class TElem>
|
|
class LeafLink : public BaseLink<TElem> {
|
|
public:
|
|
using ElemPtr = std::shared_ptr<TElem>;
|
|
|
|
LeafLink(std::shared_ptr<TElem> e) : BaseLink<TElem>(e) {}
|
|
|
|
void addChild(const ElemPtr&) override {
|
|
throw std::logic_error("Leaf cannot have children");
|
|
}
|
|
};
|