userver: meta::kIsDetected Concept Reference
Loading...
Searching...
No Matches
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 59 of file meta_light.hpp.