#include "coco/ADT/PtrLink.h"
#include <cassert>
+#include <type_traits>
namespace coco
{
public:
Node(const PtrLink<Child, Parent> *link) : _link{link}
{
+ static_assert(std::is_base_of<Node, Child>::value, "Type `Child` must be subclass of `Node`.");
+
_prev = nullptr;
_next = nullptr;
}
assert(_prev == nullptr);
assert(_next == nullptr);
- // REQUIRE Child should inheir Node class
auto curr = reinterpret_cast<Child *>(this);
// Update the link of the current node
assert(_prev == nullptr);
assert(_next == nullptr);
- // REQUIRE Child should inherit Node class
auto curr = reinterpret_cast<Child *>(this);
// Update the link of the current node
public:
void detach(void)
{
- // REQUIRE Child SHOULD inherit Node class
auto curr = reinterpret_cast<Child *>(this);
// Update parent-child relation