IRSOL
C++ code implementing socket server for interacting with Baumer camera.
Metaprogramming

Template traits and utilities for the irsol library. More...

Files

file  traits.hpp
 Template metaprogramming traits for type introspection in the irsol library.
 

Namespaces

namespace  irsol::traits
 Metaprogramming utility namespace.
 

Classes

struct  irsol::traits::always_false< T >
 Always evaluates to false, regardless of the type. More...
 
struct  irsol::traits::is_type_in_variant< T, VariantT >
 Checks whether a type T is one of the types in a std::variant. More...
 

Variables

template<typename T , typename VariantT >
constexpr bool irsol::traits::is_type_in_variant_v = is_type_in_variant<T, VariantT>::value
 Variable template shorthand for is_type_in_variant.
 

Detailed Description

Template traits and utilities for the irsol library.

This group contains generic compile-time utilities and type traits used in the irsol codebase, particularly for constraining templates, evaluating type membership in variants, and managing unreachable code paths.

Variable Documentation

◆ is_type_in_variant_v

template<typename T , typename VariantT >
constexpr bool irsol::traits::is_type_in_variant_v = is_type_in_variant<T, VariantT>::value
constexpr

Variable template shorthand for is_type_in_variant.

Evaluates to true if T is in the given variant type. This is a convenience alias for cleaner syntax in if constexpr and enable_if_t constructs.

if constexpr (irsol::traits::is_type_in_variant_v<T, MyVariant>) {
// Valid only for types in MyVariant
}
template <typename T,
std::enable_if_t<irsol::traits::is_type_in_variant_v<T, MyVariant>, int> = 0>
void myFunctionTemplate(const T& msg) {
// Only enabled for T types present in MyVariant
}
auto msg
Template Parameters
TThe type to check.
VariantTA std::variant type to check against.

Definition at line 106 of file traits.hpp.