Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
sfinae
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#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; }
clang++
Show compiler warnings
[
+
] Compiler args
[
+
]
Show input
Compilation time: 0.86 sec, absolute running time: 0.22 sec, cpu time: 0.15 sec, memory peak: 3 Mb, absolute service time: 1,08 sec
edit mode
|
history
|
discussion
1000