Sen API
Sen Libraries
Loading...
Searching...
No Matches
Template Meta Programming

Compile-time template magic. More...

Collaboration diagram for Template Meta Programming:

Classes

struct  sen::ShouldBePassedByValue< T >
 Utility to indicate that your class wants to be passed by value in some of the library calls. More...
struct  sen::HasValueType< typename, typename >
 return false if T has not an 'using ValueType' or a 'typedef ValueType' More...
struct  sen::HasValueType< T, std::void_t< typename T::ValueType > >
 return true if T has an 'using ValueType' or a 'typedef ValueType' More...
struct  sen::HasOperator< S, T >
 Allows compile-time check for the presence of various operators. More...
struct  sen::Overloaded< Ts >
 Helper type for std::variant lambda visitors. More...
struct  sen::IsContained< T, TypeList >
 Checks if T is on of the types in TypeList. More...
struct  sen::IsVariantMember< T, VariantType >
 Checks if T is on of the member types of the given VariantType. More...
struct  sen::IsVariantMember< T, std::variant< MemberTypes... > >
 Checks if T is on of the member types of the given VariantType. More...

Typedefs

template<typename T>
using sen::AddConstRef = std::add_lvalue_reference_t<std::add_const_t<T>>
 returns 'const T&'
template<typename T>
using sen::MaybeRef = std::conditional_t<std::is_arithmetic_v<T> || shouldBePassedByValueV<T>, T, AddConstRef<T>>
 returns 'const T&' or 'T' depending on the type

Functions

template<class... Ts>
 sen::Overloaded (Ts...) -> Overloaded< Ts... >
 Explicit deduction guide (not needed as of C++20).

Variables

template<typename T>
constexpr bool sen::shouldBePassedByValueV = ShouldBePassedByValue<T>::value

Detailed Description

Compile-time template magic.


Class Documentation

◆ sen::IsVariantMember

struct sen::IsVariantMember
template<typename T, typename VariantType>
struct sen::IsVariantMember< T, VariantType >

Checks if T is on of the member types of the given VariantType.

Typedef Documentation

◆ AddConstRef

template<typename T>
using sen::AddConstRef = std::add_lvalue_reference_t<std::add_const_t<T>>

returns 'const T&'

◆ MaybeRef

template<typename T>
using sen::MaybeRef = std::conditional_t<std::is_arithmetic_v<T> || shouldBePassedByValueV<T>, T, AddConstRef<T>>

returns 'const T&' or 'T' depending on the type

Function Documentation

◆ Overloaded()

template<class... Ts>
sen::Overloaded ( Ts... ) -> Overloaded< Ts... >

Explicit deduction guide (not needed as of C++20).

Variable Documentation

◆ shouldBePassedByValueV

template<typename T>
bool sen::shouldBePassedByValueV = ShouldBePassedByValue<T>::value
inlineconstexpr