So I have a struct like this:
struct node {
node_type type;
StaticTokensContainer token_sc;
std::unique_ptr<node> left; // here
std::unique_ptr<node> right; // and here
};
When I tried to write a recursive function to convert a node to string for printing like this:
std::string node_to_string(node n) {
return "<other members converted to strings>" + node_to_string(*(n.left));
}
It gives me: function "node::node(const node &)" (declared implicitly) cannot be referenced -- it is a deleted function
I don't understand why this error is showing up, I had no problem when I did (*n) when I tried passing n as std::unique_ptr<node>, so I don't see why doing *(n.left) is not allowed.