CBMC
numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type > Struct Template Reference

Convert mp_integer or expr to any integral type. More...

#include <arith_tools.h>

Public Member Functions

std::optional< T > operator() (const mp_integer &mpi) const
 
std::optional< T > operator() (const exprt &expr) const
 
std::optional< T > operator() (const constant_exprt &expr) const
 

Static Private Member Functions

template<typename U = T, typename std::enable_if< std::is_signed< U >::value, int >::type = 0>
static auto get_val (const mp_integer &mpi) -> decltype(mpi.to_long())
 
template<typename U = T, typename std::enable_if<!std::is_signed< U >::value, int >::type = 0>
static auto get_val (const mp_integer &mpi) -> decltype(mpi.to_ulong())
 

Detailed Description

template<typename T>
struct numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >

Convert mp_integer or expr to any integral type.

Definition at line 59 of file arith_tools.h.

Member Function Documentation

◆ get_val() [1/2]

template<typename T >
template<typename U = T, typename std::enable_if< std::is_signed< U >::value, int >::type = 0>
static auto numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >::get_val ( const mp_integer mpi) -> decltype(mpi.to_long())
inlinestaticprivate

Definition at line 66 of file arith_tools.h.

◆ get_val() [2/2]

template<typename T >
template<typename U = T, typename std::enable_if<!std::is_signed< U >::value, int >::type = 0>
static auto numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >::get_val ( const mp_integer mpi) -> decltype(mpi.to_ulong())
inlinestaticprivate

Definition at line 74 of file arith_tools.h.

◆ operator()() [1/3]

template<typename T >
std::optional<T> numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >::operator() ( const constant_exprt expr) const
inline

Definition at line 109 of file arith_tools.h.

◆ operator()() [2/3]

template<typename T >
std::optional<T> numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >::operator() ( const exprt expr) const
inline

Definition at line 100 of file arith_tools.h.

◆ operator()() [3/3]

template<typename T >
std::optional<T> numeric_castt< T, typename std::enable_if< std::is_integral< T >::value >::type >::operator() ( const mp_integer mpi) const
inline

Definition at line 81 of file arith_tools.h.


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