Content deleted Content added
Demonkoryu (talk | contribs) mNo edit summary |
Undid revision 442187633 by Demonkoryu (talk) K&R indentation is accepted here |
||
Line 7:
<source lang="cpp">
struct Test
{ typedef int type;
};
template < typename T >
void f(typename T::type) {} // definition #1
template < typename T >
void f(T) {} // definition #2
int main()
{ f<Test>(10); // call #1
f<int>(10); // call #2 without error thanks to SFINAE
Line 33 ⟶ 35:
template <typename T>
struct has_typedef_type
{ // yes and no are guaranteed to have different sizes,
// specifically sizeof(yes) == 1 and sizeof(no) == 2
Line 50 ⟶ 53:
};
struct foo
{ typedef float type;
};
int main()
{ std::cout << std::boolalpha;
std::cout << has_typedef_type<int>::value << std::endl;
|