mardi 28 avril 2015

Confusing regarding a template sustitution example

I am confused about this code from "The C++ programming language 4th, 28.4.4"

template<typename T>
struct get_f_result {
private:
    template<typename X>
    static auto check(X const& x) −> decltype(f(x)); // can call f(x)
    static substitution_failure check(...); // cannot call f(x)
public:
    using type = decltype(check(std::declval<T>()));
};

The part that I am specifically confused about is this line here:

static substitution_failure check(...); // cannot call f(x)

But I remember ... could not accept non pod type? So how could this work?

Aucun commentaire:

Enregistrer un commentaire