Home > database >  Is it possible to declare a pair that contains a pointer to a similar pair
Is it possible to declare a pair that contains a pointer to a similar pair

Time:11-21

I am looking for something like:

pair<int, pair<int, ...>*>*> p;

Is it possible to declare such pair? Is there already a data structure for this?

CodePudding user response:

struct A
{
    std::pair<int, A *> p;
};

You could also inherit from the pair, but I wouldn't do it to keep the code simpler.

  •  Tags:  
  • c
  • Related