Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sfinae
#include <iostream> #include <type_traits> template<typename T, typename V = bool> struct gpuConsumer : std::false_type {}; template<typename T> struct gpuConsumer<T, typename std::enable_if< std::is_same<typename T::gpu_type, T>::value // bool: gpu tipus-e , bool>::type> : std::true_type {}; struct X { using gpu_type = X; }; struct Y { int gpu_type = 1; }; struct Z { using gpu_type = int; }; struct A { }; int main() { std::cout << gpuConsumer<X>::value; std::cout << gpuConsumer<Y>::value; std::cout << gpuConsumer<Z>::value; std::cout << gpuConsumer<A>::value; }
run
|
edit
|
history
|
help
0
Clang-IsBaseOf
regimeketopdf
U2
Error
Recursive Call Example Sum
Apple is not convertible to itself (clang 3.8.0)
BinaryGap, C++ - Find longest sequence of zeros in binary representation of an integer.
Merge Sort
template specialization inheritance problem
Struct memory ordering