lundi 27 novembre 2017

Ambiguous template instantiation

Can someone explain the ambiguity here?

template <typename...> struct thing;

template <typename... Rest>
struct thing<int&, Rest&...> {
    thing(int&, Rest&...) { }
};

template <typename First, typename... Rest>
struct thing<First&, Rest&...> {
    thing(First&, Rest&...) { }
};

int main() {
    int myint;
    char mychar;
    thing<int&, char&> t(myint, mychar);
}

Aucun commentaire:

Enregistrer un commentaire