sanisizer
Sanitize sizes to avoid integer overflow
Loading...
Searching...
No Matches
sanisizer::Cast< Value_ > Class Template Reference

Cast an integer in a function call. More...

#include <class.hpp>

Public Member Functions

constexpr Cast (Value_ x)
 
template<typename Output_ >
constexpr operator Output_ () const
 

Detailed Description

template<typename Value_>
class sanisizer::Cast< Value_ >

Cast an integer in a function call.

Template Parameters
Value_Type of the integer to be casted from. This may also be an Attestation.

Consider a function f(T x) for some (non-template) integer T. When calling this function on an integer y, we can use f(Cast(y)), which will automatically cast y to T via cast().

Constructor & Destructor Documentation

◆ Cast()

template<typename Value_ >
sanisizer::Cast< Value_ >::Cast ( Value_ x)
inlineconstexpr
Parameters
xInteger value.

Member Function Documentation

◆ operator Output_()

template<typename Value_ >
template<typename Output_ >
sanisizer::Cast< Value_ >::operator Output_ ( ) const
inlineconstexpr
Template Parameters
Output_Type of the integer to be casted to.
Returns
x as an Output_, or an error if the cast fails.

The documentation for this class was generated from the following file: