Hi,
I haven't found any discussion of this issue; it's possible I've just
missed it. Anyway, the short form is that I'm trying to partially
specialize a class for tuple types. I specialize for cons, but
specialization requires an exact type match, so tuple<...> will fail to
match cons<...> and instead fall to the base template<class T>
case--which has the wrong behavior.
If I assume that the passed type is a tuple, I can use inheritance
trickery and inherit from the tuple<...>::inherited case to match the
correct case. Of course, this assumes that the template type is a tuple,
when I can't make that assumption--I'm using specialization precisely
because the type isn't known.
I could specialize on tuple, but that sets another arbitrary
max tuple size; it would be nice to be able to match all tuples allowed
by the boost::tuple implementation.
So: I need a way to determine if a particular type is a tuple type,
which would allow me to do the following:
template
class FooIf {};
template<class T>
class Foo : public FooIf {};
template<class T>
class FooIf { /* tuple implementation */ };
template<class T>
class FooIf { /* non-tuple implementation */ };
AFAICT, there's no way to do so at present. I'd like to suggest a way to
add this functionality: have cons<> (or tuple<>) inherit from a blank
"tuple_base" class. This would let us use boost::is_base_and_derived to
provide the is_tuple_type functionality for the code block above.
Of course, it's possible I'm just missing a simple way to partially
specialize for tuple types, or that such functionality is bad and
unecessary. Thoughts?
----
Bryan Silverthorn :: bcs26@cornell.edu