Detection Idiom =============== .. role:: cpp(code) :language: cpp The Detection Idiom is used to recognize, in an SFINAE-friendly way, the validity of any C++ expression. Header File: ```` The Kokkos Detection Idiom is based upon the detection idiom from Version 2 of the C++ Extensions for Library Fundamentals, ISO/IEC TS 19568:2017, a draft of which can be found `here `. The original C++ proposal can be found at `here `. API --- .. code-block:: cpp // VOID_T and DETECTOR are exposition-only and not intended to be used directly. // Convenient metafunction to leverage SFINAE template using VOID_T = void; // Primary template for types not supporting the archetypal Op template class /* Op */, class... /* Args */> struct DETECTOR { using value_t = std::false_type; using type = Default; }; // Specialization for types supporting the archetypal Op template class Op, class... Args> struct DETECTOR>, Op, Args...> { using value_t = std::true_type; using type = Op; }; .. code-block:: cpp namespace Kokkos { // Simplification of the type returned by detected_t for types not supporting the archetype provided struct nonesuch { nonesuch(nonesuch&&) = delete; ~nonesuch() = delete; }; // is_detected is an alias for std::true_type if Op is a valid type // otherwise, an alias for std::false_type template