List with 3 c++ elements

Asked

Viewed 51 times

0

I’m using list in c++, and in what I think its internal structure should contain:

Content
pointer to the next element

It is possible to place one more variable within this structure, as the example below?

Content
variable string
pointer to the next element

1 answer

0


No, it is not possible to modify the standard library. Anything of the kind is prohibited. 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>.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.