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
Visual Studio expand modified
kkk
Shadow pointer member variable
This is the first one
infix to postfix v 1.0
123
#22.2
Temp 1
accessing private of different type of template
C string literal