userver: userver/utils/meta_light.hpp File 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_light.hpp File Reference

Lightweight concepts. More...

#include <type_traits>
#include <userver/utils/void_t.hpp>
+ Include dependency graph for meta_light.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  meta::NotDetected
 

Typedefs

template<template< typename... > typename Trait, typename... Args>
using meta::DetectedType = typename impl::Detector< NotDetected, void, Trait, Args... >::type
 Produces the result type of a trait, or utils::meta::NotDetected if it's incorrect for the given template args.
 
template<typename Default , template< typename... > typename Trait, typename... Args>
using meta::DetectedOr = typename impl::Detector< Default, void, Trait, Args... >::type
 Produces the result type of a trait, or Default if it's incorrect for the given template args.
 
template<typename T , typename U >
using meta::ExpectSame = std::enable_if_t< std::is_same_v< T, U > >
 Helps in definitions of traits for utils::meta::kIsDetected.
 

Variables

template<template< typename... > typename Template, typename T >
constexpr bool meta::kIsInstantiationOf
 Returns true if the type if an instantiation of the specified template.
 
template<typename T >
constexpr bool meta::kIsCharacter
 
template<typename T >
constexpr bool meta::kIsInteger
 

Detailed Description

Lightweight concepts.

See also
userver/utils/meta.hpp for more concepts

Definition in file meta_light.hpp.

Typedef Documentation

◆ DetectedOr

template<typename Default , template< typename... > typename Trait, typename... Args>
using meta::DetectedOr = typedef typename impl::Detector<Default, void, Trait, Args...>::type

Produces the result type of a trait, or Default if it's incorrect for the given template args.

See also
utils::meta::kIsDetected

Definition at line 83 of file meta_light.hpp.

◆ DetectedType

template<template< typename... > typename Trait, typename... Args>
using meta::DetectedType = typedef typename impl::Detector<NotDetected, void, Trait, Args...>::type

Produces the result type of a trait, or utils::meta::NotDetected if it's incorrect for the given template args.

See also
utils::meta::kIsDetected

Definition at line 75 of file meta_light.hpp.

◆ ExpectSame

template<typename T , typename U >
using meta::ExpectSame = typedef std::enable_if_t<std::is_same_v<T, U> >

Helps in definitions of traits for utils::meta::kIsDetected.

Definition at line 87 of file meta_light.hpp.

Variable Documentation

◆ kIsCharacter

template<typename T >
constexpr bool meta::kIsCharacter
inlineconstexpr
Initial value:
=
std::is_same_v<T, char> || std::is_same_v<T, wchar_t> ||
std::is_same_v<T, char16_t> || std::is_same_v<T, char32_t>

Returns true if the type is a fundamental character type. signed char and unsigned char are not character types.

Definition at line 97 of file meta_light.hpp.

◆ kIsInstantiationOf

template<template< typename... > typename Template, typename T >
constexpr bool meta::kIsInstantiationOf
inlineconstexpr
Initial value:
=
impl::IsInstantiationOf<Template, T>::value

Returns true if the type if an instantiation of the specified template.

Definition at line 91 of file meta_light.hpp.

◆ kIsInteger

template<typename T >
constexpr bool meta::kIsInteger
inlineconstexpr
Initial value:
=
std::is_integral_v<T> && !kIsCharacter<T> && !std::is_same_v<T, bool>

Returns true if the type is a true integer type (not *char* or bool) signed char and unsigned char are integer types

Definition at line 104 of file meta_light.hpp.