Content deleted Content added
mNo edit summary |
|||
Line 8:
<source lang="cpp">
struct Test {
typedef int
};
template <typename T>
void f(typename T::
template <typename T>
Line 19:
int main() {
f<Test>(10); // Call #1.
f<int>(10); // Call #2. Without error (even though there is no int::foo) thanks to SFINAE.
}
</source>
Line 33:
template <typename T>
struct
// Variables "yes" and "no" are guaranteed to have different sizes,
// specifically sizeof(yes) == 1 and sizeof(no) == 2.
Line 40:
template <typename C>
static yes& test(typename C::
template <typename>
Line 51:
struct foo {
typedef float
};
int main() {
std::cout << std::boolalpha;
std::cout <<
std::cout <<
}
</source>
When <code>T</code> has the nested type <code>
Developers of [[Boost C++ Libraries|Boost]] used SFINAE to great effect in boost::enable_if<ref name="enable_if">[http://www.boost.org/doc/libs/release/libs/utility/enable_if.html Boost Enable If]</ref> and in other ways.
|