General Utility Library for C++14  2.12
Classes | Typedefs | Functions
gul14/traits.h

Detailed Description

Type traits and helpers for metaprogramming.

Classes

struct  gul14::IsContainerLike< T, typename >
 Helper type trait object to determine if a type is a container. More...
 

Typedefs

template<typename T >
using gul14::remove_cvref = typename std::remove_cv< std::remove_reference_t< T > >
 A template metafunction that removes const, volatile, and reference qualifiers from a type. More...
 
template<typename T >
using gul14::remove_cvref_t = typename remove_cvref< T >::type
 A template metafunction that removes const, volatile, and reference qualifiers from a type. More...
 
template<typename... >
using gul14::void_t = void
 A type mapping an arbitrary list of types to void (for SFINAE). More...
 
template<typename F , typename... Args>
using gul14::invoke_result = detail_invoke_result::invoke_result< void, F, Args... >
 A metafunction that computes the result of invoking a callable object of type F with the given arguments. More...
 
template<typename F , typename... Args>
using gul14::invoke_result_t = typename invoke_result< F, Args... >::type
 A shortcut for invoke_result<...>::type. More...
 
template<typename F , typename... Args>
using gul14::is_invocable = detail_invocable::is_invocable< void, F, Args... >
 A type trait that checks whether a callable object of type F can be invoked with the given arguments. More...
 
template<typename R , typename F , typename... Args>
using gul14::is_invocable_r = detail_invocable::is_invocable_r< void, R, F, Args... >
 A type trait that checks whether a callable object of type F can be invoked with the given arguments and returns a result convertible to R. More...
 

Functions

template<typename F , typename... Args>
constexpr auto gul14::invoke (F &&f, Args &&... args) noexcept(noexcept(detail_invoke::invoke(std::forward< F >(f), std::forward< Args >(args)...))) -> decltype(detail_invoke::invoke(std::forward< F >(f), std::forward< Args >(args)...))
 Invoke a callable object f with the given arguments. More...
 

Typedef Documentation

◆ invoke_result

template<typename F , typename... Args>
using gul14::invoke_result = typedef detail_invoke_result::invoke_result<void, F, Args...>

A metafunction that computes the result of invoking a callable object of type F with the given arguments.

The result is available in the member typedef type.

This is a backport of C++17's std::invoke_result.

Since
GUL version 2.11

◆ invoke_result_t

template<typename F , typename... Args>
using gul14::invoke_result_t = typedef typename invoke_result<F, Args...>::type

A shortcut for invoke_result<...>::type.

This is a backport of C++17's std::invoke_result_t.

Since
GUL version 2.11

◆ is_invocable

template<typename F , typename... Args>
using gul14::is_invocable = typedef detail_invocable::is_invocable<void, F, Args...>

A type trait that checks whether a callable object of type F can be invoked with the given arguments.

The boolean result is available in the member value.

This is a backport of C++17's std::is_invocable.

Since
GUL version 2.11

◆ is_invocable_r

template<typename R , typename F , typename... Args>
using gul14::is_invocable_r = typedef detail_invocable::is_invocable_r<void, R, F, Args...>

A type trait that checks whether a callable object of type F can be invoked with the given arguments and returns a result convertible to R.

The boolean result is available in the member value.

This is a backport of C++17's std::is_invocable_r.

Since
GUL version 2.11

◆ remove_cvref

template<typename T >
using gul14::remove_cvref = typedef typename std::remove_cv<std::remove_reference_t<T> >

A template metafunction that removes const, volatile, and reference qualifiers from a type.

The stripped type is available in the member typedef type.

This is a substitute for C++20's std::remove_cvref.

Since
GUL version 2.9

◆ remove_cvref_t

template<typename T >
using gul14::remove_cvref_t = typedef typename remove_cvref<T>::type

A template metafunction that removes const, volatile, and reference qualifiers from a type.

This is a substitute for C++20's std::remove_cvref_t.

Since
GUL version 2.9

◆ void_t

template<typename... >
using gul14::void_t = typedef void

A type mapping an arbitrary list of types to void (for SFINAE).

This is a helper metafunction to substitute C++17's std::void_t.

Since
GUL version 2.9

Function Documentation

◆ invoke()

template<typename F , typename... Args>
constexpr auto gul14::invoke ( F &&  f,
Args &&...  args 
) -> decltype(detail_invoke::invoke(std::forward<F>(f), std::forward<Args>(args)...))
inlineconstexprnoexcept

Invoke a callable object f with the given arguments.

This is a backport of C++17's std::invoke.

Since
GUL version 2.11