Sen API
Sen Libraries
Loading...
Searching...
No Matches
class_helpers.h File Reference

Here we define a set of template meta-programming helpers to let the compiler take some decisions based on what it knows about the types when instantiated. More...

#include "sen/core/base/compiler_macros.h"
#include <type_traits>
#include <utility>
#include <variant>

Go to the source code of this file.

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, std::variant< MemberTypes... > >
 Checks if T is on of the member types of the given VariantType. More...

Namespaces

namespace  sen

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

Here we define a set of template meta-programming helpers to let the compiler take some decisions based on what it knows about the types when instantiated.