Content deleted Content added
→Example: ed: reworded "if...sizeof...calling...is equal" -> "if...sizeof...calling...would be equal" for clarity |
mNo edit summary |
||
Line 12:
template <typename T>
void f(typename T::type) {} //
template <typename T>
void f(T) {} //
int main() {
f<Test>(10); //
f<int>(10); //
}
</source>
Line 34:
template <typename T>
struct has_typedef_type {
// Variables "yes" and "no" are guaranteed to have different sizes,
// specifically sizeof(yes) == 1 and sizeof(no) == 2.
typedef char yes[1];
typedef char no[2];
Line 45:
static no& test(...);
//
// the first overload worked and T has a nested type named type.
static const bool value = sizeof(test<T>(0)) == sizeof(yes);
|