
From: Bruno Lalande [mailto:bruno.lalande@gmail.com] Wouldn't the following give the desired result?
Yes, in fact after I found no answers in my mailbox this morning I noodled on the problem some more and came up with that solution. The difficulty is that there is a lot of non-variadic cruft common to the general and specialized template classes. I didn't want to repeat all of that. My solution was to insert a new intermediate template class in the hierarchy. But that would scale poorly if there were a richer set of variadic member enabling conditions. And maintaining extra layers of forwarding constructor definitions can be tedious and error-prone. Oh well, one can't have everything. To summarize the issue: boost::enable_if does not seem to work for selectively declaring member function signatures so if you have members with signatures that vary in a complex way depending on template parameters you have to use class template specialization. To avoid repeating non-variadic member declarations, factor them into a common public base class. Here's my class hierarchy now: template<S,W> class pre_base; // common thing interface elements template<S,W=void> class base : public pre_base<S,W> // general thing interface template<S> class base<S,void> : public pre_base<S,void> // thing interface with no W ... // a thing_list is a compound thing (exposes a thing interface) template <S,W> thing_list_base : public base<S,W> // common implementation for a list of things template <S,W=void> thing_list : public thing_list_base<S,W> // general impl. for list of general things template <S> thing_list<S,void> : public thing_list_base<S,void> // impl. for list of things w/o Ws. The repeated specialization pattern is what I was missing; the concrete class template and the interface templates use the same pattern. I had the interface declarations in place but was struggling with the concrete class templates. Thank you! -swn