sanisizer
Sanitize sizes to avoid integer overflow
Loading...
Searching...
No Matches
sanisizer::Attestation< Integer_, max_ > Struct Template Reference

Attest to additional compile-time properties of an integer. More...

#include <attest.hpp>

Public Types

typedef Integer_ Integer
 

Public Member Functions

constexpr Attestation (Integer_ x)
 

Public Attributes

Integer_ value
 

Static Public Attributes

static constexpr Integer_ max = max_
 

Detailed Description

template<typename Integer_, Integer_ max_>
struct sanisizer::Attestation< Integer_, max_ >

Attest to additional compile-time properties of an integer.

Template Parameters
Integer_Type of the integer.
max_Maximum value of the integer, known at compile time. This should be non-negative.

max_ is a compile-time attestations to the properties of the integer. This allows developers to specify more constraints on the integer than would otherwise be provided by Integer_. For example, we could attest that a std::size_t has a upper limit of max_ = 2^31 - 1.

Member Typedef Documentation

◆ Integer

template<typename Integer_ , Integer_ max_>
Integer_ sanisizer::Attestation< Integer_, max_ >::Integer

Type of the integer.

Constructor & Destructor Documentation

◆ Attestation()

template<typename Integer_ , Integer_ max_>
sanisizer::Attestation< Integer_, max_ >::Attestation ( Integer_ x)
inlineconstexpr
Parameters
xValue of the integer. This should be no greater than max_.

Member Data Documentation

◆ max

template<typename Integer_ , Integer_ max_>
Integer_ sanisizer::Attestation< Integer_, max_ >::max = max_
staticconstexpr

Maximum value of the integer, known at compile time. This will be non-negative.

◆ value

template<typename Integer_ , Integer_ max_>
Integer_ sanisizer::Attestation< Integer_, max_ >::value

Value of the integer.


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