What good are typelists?
Just a quick question, but I fail to see the point with typelists.
The book mentions that a typelist is good for an abstract library which we want to abstract. Say:
(Example from book [Modern C++ Design].)
virtual Window* CreateWindow() = 0;
virtual Button* CreateButton() = 0;
virtual ScrollBar* CreateScrollBar() = 0;
The book goes on about how to use and manipulate typelists, but never what they're good for and how they can be used to abstract this interface.
Anyone have any good explanation or example?
The book introduces typelists early because they're a very fundamental utility used throughout the rest of the book. Just keep reading, and you'll find some applications.
I see. Well, there are yet some chapters to plow through.
Thanks for the answer, though.
Specifically, chapter 10 and 11 make heavy use of typelists.
is it possible to use a typelist in conjunction with a variable argument function to disambiguate the types of the arguments passed to the function?
i hope that makes sense.
So far as I understand, it's a way to take a variable amount of types in a template declaration (or whatever it's called). Similar to variable arguments for functions.
Yes, but it's a mess to implement, and the restrictions on varargs still apply - i.e., PODs only.
Originally Posted by m37h0d