Detects whether trait Op holds for the given Args.

Synopsis

Declared in <llvm/ADT/STLForwardCompat.h>

template<
    template<class...> typename Op,
    class... Args>
using is_detected = /* implementation-defined */::value_t;

Description

For example, the given trait could be used to detect if a given type has a copy assignment operator: template<class T> using has_copy_assign_t = decltype(std::declval<T&>() = std::declval<const T&>()); bool fooHasCopyAssign = is_detected<has_copy_assign_t, FooClass>::value;

NOTE: The C++20 standard has adopted concepts and requires clauses as a superior alternative to std::is_detected.

This utility is placed in STLForwardCompat.h as a reminder to migrate usages of llvm::is_detected to concepts and 'requires' clauses when the codebase adopts C++20.

Created with MrDocs