mardi 2 août 2016

Test if a not class member function exists (SFINAE)

I have defined many objects, and for some of them, i defined a function :

template <typename Ratio> 
auto print(const T &t, bool a= true, bool b= true)
{
    std::stringstream ss;
    // ... do stuff ...
    return ss.str();
}

where T is the type of one of the objects for which print is defined.

My question is : Is there a way for a type T to find if this function exists ?

For others uses, i already used templates and SFINAE to detect if a class member method exists. But for my problem here, i can't find the solution ... Anyone ?

Thanks, Ben

Aucun commentaire:

Enregistrer un commentaire