Speclib  0.1.2
The library for writing better CUDA libraries
sp::StaticAssert Struct Reference

Static asserts that exploit template expansion backtraces to show you the values involved in the failing assert. More...

#include <StaticAssert.hpp>

Static Public Member Functions

template<auto X, auto Y>
constexpr static void Eq ()
 Assert that two values are equal. More...
 
template<auto X, auto Y>
constexpr static void Ne ()
 Assert that two values are not equal. More...
 
template<auto X, auto Y>
constexpr static void Lt ()
 Assert that X < Y. More...
 
template<auto X, auto Y>
constexpr static void Gt ()
 Assert that X > Y. More...
 
template<auto X, auto Y>
constexpr static void Le ()
 Assert that X <= Y. More...
 
template<auto X, auto Y>
constexpr static void Ge ()
 Assert that X >= Y. More...
 
template<auto X, auto Y>
constexpr static void Divisible ()
 Assert that X % Y == 0. More...
 
template<typename X , typename Y >
constexpr static void TypeEq ()
 Assert two types are equal. More...
 

Detailed Description

Static asserts that exploit template expansion backtraces to show you the values involved in the failing assert.

Custom messages can be supported with C++20 string tparams. Or a C++17 equivalent (although all such things that currently exist are necessarily insane).

Member Function Documentation

◆ Divisible()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Divisible ( )
staticconstexpr

Assert that X % Y == 0.

◆ Eq()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Eq ( )
staticconstexpr

Assert that two values are equal.

◆ Ge()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Ge ( )
staticconstexpr

Assert that X >= Y.

◆ Gt()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Gt ( )
staticconstexpr

Assert that X > Y.

◆ Le()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Le ( )
staticconstexpr

Assert that X <= Y.

◆ Lt()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Lt ( )
staticconstexpr

Assert that X < Y.

◆ Ne()

template<auto X, auto Y>
constexpr static void sp::StaticAssert::Ne ( )
staticconstexpr

Assert that two values are not equal.

◆ TypeEq()

template<typename X , typename Y >
constexpr static void sp::StaticAssert::TypeEq ( )
staticconstexpr

Assert two types are equal.