KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
While reading this question , I came across @Johannes 's answer. template<typename> struct void_ { typedef void type; }; template<typename T, typename = void> // Line 1 struct is_class { static bool const value = false; }; template<typename T> struct is_class<T, typename void_<int T::*>::type> { // Line 2 static bool const value = true; }; This construct finds if the given type is a class or not . What puzzles me is the new kind of syntax for writing this small meta program. Can anyone explain in detail: Why we need Line 1 ? What is the meaning of syntax <int T::*> as template parameter in Line 2 ?
Tags (comma-separated)
Save Edits
Cancel