userver: meta::kIsDetected Concept Reference
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
meta::kIsDetected Concept Reference

Checks whether a trait is correct for the given template args. More...

#include <userver/utils/meta_light.hpp>

Concept definition

template<template< typename... > typename Trait, typename... Args>
concept meta::kIsDetected = requires { typename Trait<Args...>; }

Detailed Description

Checks whether a trait is correct for the given template args.

Implements the pre-cpp20-concepts detection idiom.

To use, define a templated type alias (a "trait"), which for some type either is correct and produces ("detects") some result type, or is SFINAE-d out. Example:

template <typename T>
using HasValueType = typename T::ValueType;
...
if constexpr (utils::meta::kIsDetected<HasValueType, T>) { ... }

Definition at line 61 of file meta_light.hpp.