An interesting article as well as a nice demo!
A true heterogeneous container in C++
by Andy G
From the article:
Oftentimes I see questions StackOverflow asking something to the effect of
“Can I have a std::vector that holds more than one type?”
The canonical, final, never-going-to-change answer to this question is a thorough“No”
C++ is a statically-typed language. A vector will hold an object of a single type, and only a single type.“But…”
Of course there are ways to work around this...
Add a Comment
Comments are closed.