I am only just now learning Loki and typelists (Modern C++ Design text). But when I see the macros for creating typelists (on page 52), I had to ask if those macros have yet been replaced with boost-style preprocessor macros?
For example, I could write a boost preprocessor macro that allows me to create a typelist like this:
TYPELIST(
(char)
(int)
(unsigned int)
)
Notice that I did not need to specify how many types are in the list? So I will ask my question again - has such boost preprocessor utilization been retrofitted into the current Loki implementation? Yes? No? Why not?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've only read up to page 65 in Alexandrescu's book, so... is Loki::Seq something new since that publication, or will I encounter it later in the book?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
By the way, you said "You could do it (like in boost) completely without the preprocessor, use Loki::Seq. "
This caught my attention...I was referring to techniques used in Boost's "Preprocessor Metaprogramming", which has allowed me to handle "lists" without specifying number.
For example, I made an ENUM macro that creates an enumeration, and an array of char* to match the enum. And it isn't necessary anywhere to specify how long the list is.
But I took your words as meaning "its not possible to do such list-processing with the preprocessor." So I'm a little confused...(status quo, actually)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am only just now learning Loki and typelists (Modern C++ Design text). But when I see the macros for creating typelists (on page 52), I had to ask if those macros have yet been replaced with boost-style preprocessor macros?
For example, I could write a boost preprocessor macro that allows me to create a typelist like this:
TYPELIST(
(char)
(int)
(unsigned int)
)
Notice that I did not need to specify how many types are in the list? So I will ask my question again - has such boost preprocessor utilization been retrofitted into the current Loki implementation? Yes? No? Why not?
You could do it (like in boost) completely without the preprocessor, use Loki::Seq.
For example see test/Factors:
//with preprocessor:
Factory< AbstractProduct, int,LOKI_TYPELIST_3(CreateFunctor,int,int) >,
// w/o prep.
Factory< AbstractProduct, int,Seq<CreateFunctor,int,int> >,
I've only read up to page 65 in Alexandrescu's book, so... is Loki::Seq something new since that publication, or will I encounter it later in the book?
Yes, Seq came after the book. It appears to be essentially the same as the typelist macros, but the current docs don't cover it (e.g. http://loki-lib.sourceforge.net/html/classes.html\).
By the way, you said "You could do it (like in boost) completely without the preprocessor, use Loki::Seq. "
This caught my attention...I was referring to techniques used in Boost's "Preprocessor Metaprogramming", which has allowed me to handle "lists" without specifying number.
For example, I made an ENUM macro that creates an enumeration, and an array of char* to match the enum. And it isn't necessary anywhere to specify how long the list is.
But I took your words as meaning "its not possible to do such list-processing with the preprocessor." So I'm a little confused...(status quo, actually)