Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Clang-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)); }; int main() { static_assert(IsBaseOf<A, B>::value, "Pass"); }
run
|
edit
|
history
|
help
0
U2
pack expansion
Unlike C (even C99/C11), C++ allows initializers in if-conditions, so this compiles.
boost::geometry::distance performance overhead compared to a straightforward implementation
Linker error while passing constexpr variable as const &
DESim Example Starter Code
BucketSort
DESim Example with Hash Table
Forgetting to check end
Check if a year is leap year or not