codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
template <void (*F)()> struct SigFoo { static const int x = 0; }; template <class T> struct RequiredStatics { template <class U> static int doCheck() { return SigFoo< U::foo >::x + SigFoo< U::boo >::x; } static int dummy; protected: ~RequiredStatics() {} }; /* dunno why, but g++ requires that template<> */ #define _ForceStaticMethodsCheck(D,B) ; \ template <> \ int B<D>::dummy = B<D>::doCheck<D>() struct Foo { // try commenting following lines static void foo() {}; static void boo() {}; } _ForceStaticMethodsCheck(Foo, RequiredStatics); int main(int argc, char* argv[]) { return 0; }
Private
[
?
]
Run code
Submit