#pragma once #include #include "point.hpp" namespace kd { template class KdNode { public: KdNode(const U& data) : axis(0), coord(Point(0, 0)), left(nullptr), right(nullptr), data(data) {} KdNode(const Point& coord, const U& data) : axis(0), coord(coord), left(nullptr), right(nullptr), data(data) {} KdNode(unsigned char axis, const Point& coord, const U& data) : axis(axis), coord(coord), left(nullptr), right(nullptr), data(data) {} KdNode(unsigned char axis, const Point& coord, KdNode* left, KdNode* right, const U& data) : axis(axis), coord(coord), left(left), right(right), data(data) {} ~KdNode(); unsigned char axis; Point coord; KdNode* left; KdNode* right; U data; }; template KdNode::~KdNode() { delete left; delete right; } }