Reproducing lua table in C/C++

As we know, the lua language derived from C. So the question I would ask is: can I create a structure like the lua table that can contain any data type (bool, int, string, other table ) in C/C++?.
Similar work can be done with struct, but you can not add or remove items, while std::map only accept the type specified in their statement.

It is possible to do such a thing? If so, can you give some hints?
I heard that a more dynamic solution is to use polymorphism, you can store pointers to a base class and so on. In what way polymorphism may help in this case?
Topic archived. No new replies allowed.