C++ templates and derived classes

c++, derived, templates

Solution

It's an implementation of Member Detector Idiom. It uses SFINAE to check whether type T has got a member called `flow`.

Edit: The comma part you're asking about is multiple inheritance. Struct Derived is (publicly) inheriting from both T and Fallback.

Problem

I am trying to understand the following code. Derived is a derived structure from T and what does "," means and then Fallback {} ``` template <class T> struct has_FlowTraits<T, true> { struct Fallback { bool flow; }; struct Derived : T, Fallback { }; //What does it means ? template<typename C> static char (&f(SameType<bool Fallback::*, &C::flow>*))[1]; template<typename C> static char (&f(...))[2]; public: static bool const value = sizeof(f<Derived>(0)) == 2; }; ```

Original source