8. (Overlapping Enabler Conditions) Function templates with enabling conditions that are not mutually exclusive can lead to

Question:

8. (Overlapping Enabler Conditions)

Function templates with enabling conditions that are not mutually exclusive can lead to ambiguities. Once the compiler has examined the enabling conditions and included the function into the overload resolution set, normal C++ overload resolution rules are then used to select the best matching function. Examine how this can occur based on the following example and how to resolve the ambiguity:

template

typename enable_if, void>::type foo(T t) {}

template

typename enable_if, void>::type foo(T t) {}

(hint: all integral types are also arithmetic).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: