Speclib  0.1.2
The library for writing better CUDA libraries

Type traits. More...

Classes

struct  sp::real_type< T >
 Get the underlying numeric type for a complex number type. No-op for non-complex types. More...
 
struct  sp::value_type< T >
 Extract the ValueType member from a type. More...
 
struct  sp::value_type_or_identity< T, typename >
 Extract the ValueType member from a type. If there isn't one, return the input type. More...
 
struct  sp::value_type_or_common< T, Q, typename >
 Extract the ValueType member from a type. If there isn't one, return the input type. More...
 
struct  sp::deduce_rank< T, typename >
 Extract the Rank member from a type. If there isn't one, return 0. More...
 
struct  sp::make_signed< T, Q >
 Like std::make_signed, but returns the input type if it is non-integer. More...
 
struct  sp::are_same< T, Ts >
 N-ary version of std::is_same. More...
 
struct  sp::isnt_type< T, Ts >
 Check that all Ts... are not T. More...
 
struct  sp::isnt< Blacklist >
 UnaryTypeTrait factory for generating checks that a type is not in Blacklist.... More...
 
struct  sp::is_same< T >
 Makes a unary type trait for is_same. Basically currying. Generalisation might be a good idea... More...
 

Typedefs

template<typename T >
using sp::is_integral = std::conjunction< std::is_arithmetic< T >, std::disjunction< std::is_integral< T >, std::is_unsigned< T > > >
 Like std::is_integral, but returns true for unsigned types, since doing otherwise (as the STL does) is clearly mad. More...
 
template<typename T >
using sp::is_numeric = std::disjunction< sp::is_integral< T >, std::is_floating_point< T >, sp::is_complex< T > >
 Determine if a type is numeric. More...
 
template<typename T >
using sp::real_type_t = typename real_type< T >::type
 
template<typename T >
using sp::value_type_t = typename value_type< T >::type
 
template<typename T >
using sp::value_type_or_identity_t = typename value_type_or_identity< T >::type
 
template<typename T , typename... Qs>
using sp::value_type_or_common_t = typename value_type_or_common< T, sp::TypeList< Qs... > >::type
 
template<typename T >
using sp::make_signed_t = typename sp::make_signed< T >::type
 
template<bool Volatile, typename T >
using sp::maybe_volatile = std::conditional_t< Volatile, volatile T, T >
 Make a type Volatile based on the value of a constexpr bool. More...
 
template<bool Disjoint, typename T >
using sp::maybe_restrict = std::conditional_t< Disjoint, T *__restrict__, T * >
 Make a type __restrict__ based on the value of a constexpr bool. More...
 
template<template< class... > class Op, class... Args>
using sp::is_detected = typename detail::detector< nonesuch, void, Op, Args... >::value_t
 If Op<Args...> is a type that exists, std::true_type. Else std::false_type. More...
 
template<template< class... > class Op, class... Args>
using sp::detected_t = typename detail::detector< nonesuch, void, Op, Args... >::type
 
template<class Default , template< class... > class Op, class... Args>
using sp::detected_or_t = typename detail::detector< Default, void, Op, Args... >::type
 

Functions

template<typename... Ts>
auto sp::getCommonType (sp::TypeList< Ts... >)
 

Variables

template<typename T >
constexpr bool sp::is_integral_v = is_integral<T>::value
 
template<typename T >
constexpr int sp::deduce_rank_v = deduce_rank<T>::value
 
template<typename T >
constexpr bool sp::is_character
 Determine if a type is a character type. More...
 

Detailed Description

Type traits.

Some of these are extensions to standard library type-traits. A few are C++20 features.

Typedef Documentation

◆ is_detected

template<template< class... > class Op, class... Args>
using sp::is_detected = typedef typename detail::detector<nonesuch, void, Op, Args...>::value_t

If Op<Args...> is a type that exists, std::true_type. Else std::false_type.

◆ is_integral

Like std::is_integral, but returns true for unsigned types, since doing otherwise (as the STL does) is clearly mad.

◆ is_numeric

template<typename T >
using sp::is_numeric = typedef std::disjunction<sp::is_integral<T>, std::is_floating_point<T>, sp::is_complex<T> >

Determine if a type is numeric.

◆ maybe_restrict

template<bool Disjoint, typename T >
using sp::maybe_restrict = typedef std::conditional_t<Disjoint, T* __restrict__, T*>

Make a type __restrict__ based on the value of a constexpr bool.

◆ maybe_volatile

template<bool Volatile, typename T >
using sp::maybe_volatile = typedef std::conditional_t<Volatile, volatile T, T>

Make a type Volatile based on the value of a constexpr bool.

Variable Documentation

◆ is_character

template<typename T >
constexpr bool sp::is_character
constexpr
Initial value:
=
std::is_same_v<unsigned char, T> ||
std::is_same_v<signed char, T> ||
std::is_same_v<char16_t, T> ||
std::is_same_v<char32_t, T>

Determine if a type is a character type.