
6 Feb
2004
6 Feb
'04
12:46 a.m.
On Thu, Feb 05, 2004 at 06:28:27PM -0600, Brock Peabody wrote:
Is there an easy way to write:
template <typename T> struct is_variant {
typedef ??? type; };
So far the best I can come up with is:
1) T has a member type "types" and 2) T is convertible to make_variant_over<T::types>::type and 3) make_variant_over<T::types>::type is convertible to T
Does anyone have a better idea?
Perhaps I'm missing something, but why not just something like template <typename T> struct is_variant { typedef false_ type; }; template <typename T1, typename T2, ... /*however many*/> struct is_variant<variant<T1,T2,...> > { typedef true_ type; }; ? -- -Brian McNamara (lorgon@cc.gatech.edu)