As an example, a singly-linked list node might be defined as follows
namespace example_part1
{
class node
{
node * next;
int value;
}
}
assuming we have a list of integers only. This class is allowed to have a member that points to its own type, because pointers all have the same size, regardless of the size of the underlying data structure.
Now, why am I not allowed to do this
namespace example_part2
{
using node = std::pair<example_part2::node *, int>;
}
?
I know this seems like a silly example, but I want to know more the reason behind why this won't compile. I actually have a similar situation to this where it might be useful (not with std::pair). Also, assume these two code segments are from different programs, i.e. I don't have a node custom class as well as a pair aliased as a node in the same program.