Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MSVC-IsBaseOf
#include <type_traits> #include <cstdint> struct A { }; struct B : A { }; template <typename T, typename U> struct IsBaseOf { constexpr static bool Testment(T* t) { return true; } constexpr static bool Testment(...) { return false; } constexpr static bool value = IsBaseOf<T,U>::Testment(static_cast<U*>(nullptr)); }; constexpr bool IsBaseOf<A, B>::value; // necessary definition in c++14 while redundant declaration since 1z int main() { static_assert(IsBaseOf<A, B>::value, "Pass"); }
run
|
edit
|
history
|
help
0
Double_wrapper vc++
Hangman
7
Multiple inheritance of empty classes - sizeof
vc++ bug?
Structured Member Value Access Using Structure Member Pointer and Variadic Templates
5sdgts
PRIx64 on MSVC
Wide string conversion with multibyte chars and locale
VC++ error LNK2001 with combined use of non-type template parameters