List with 3 elements c ++

0

I'm using list in c ++, and in what I think the structure of the inner one should contain:

  

Content
  pointer to next element

Is it possible to put one more variable within this structure, as the example below?

  

Content
  variable string
  pointer to next element

    
asked by anonymous 05.04.2018 / 19:04

1 answer

0

No, you can not modify the default library. Anything of the sort is forbidden. You can, however, have your string variable as part of the container element:

struct Conteudo
{
    std::string str;
};

And use it as std::list<Conteudo> .

    
05.04.2018 / 21:12