Content deleted Content added
Undid revision 442187633 by Demonkoryu (talk) K&R indentation is accepted here |
Demonkoryu (talk | contribs) |
||
Line 7:
<source lang="cpp">
struct Test {
typedef int type;
};
template <
void f(typename T::type) {} // definition #1
template <
void f(T) {} // definition #2
int main() {
f<Test>(10); // call #1
f<int>(10); // call #2 without error thanks to SFINAE
Line 35 ⟶ 33:
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 53 ⟶ 50:
};
struct foo {
typedef float type;
};
int main() {
std::cout << std::boolalpha;
std::cout << has_typedef_type<int>::value << std::endl;
|