KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Inspired by this question , i'm wondering if there is some compile-time check one can introduce to detect if two given template instantiations: template <typename T> class Templ... typedef Templ<std::string> stringInstance; typedef Templ<double> doubleInstance; are constructed from the same definition, or if they are built from different specializations of the Templ template so basically the hypothetical template function will behave like this: template <typename T> class Templ {} template <> class Templ<std::string> {} template <> class Templ<double> {} template <typename T1,typename T2> class Belong_To_Same_Templ_Definition {} //tests typedef Templ<std::string> stringInstance; typedef Templ<double> doubleInstance; typedef Templ<int> intInstance; typedef Templ<char> charInstance; assert( Belong_To_Same_Templ_Definition< intInstance , charInstance >::value == true); assert( Belong_To_Same_Templ_Definition< intInstance , doubleInstance >::value == false); assert( Belong_To_Same_Templ_Definition< stringInstance , doubleInstance >::value == false); is possible to create this kind of metafunction?
Tags (comma-separated)
Save Edits
Cancel