piranha  0.10
Public Member Functions | List of all members
piranha::safe_cast_impl< To, From, sc_int_int_enabler< To, From > > Struct Template Reference

Specialisation of piranha::safe_cast() for C++ integral types. More...

#include <piranha/safe_cast.hpp>

Public Member Functions

To operator() (const From &f) const
 Call operator. More...
 

Detailed Description

template<typename To, typename From>
struct piranha::safe_cast_impl< To, From, sc_int_int_enabler< To, From > >

Specialisation of piranha::safe_cast() for C++ integral types.

This specialisation is enabled when both To and From are integral types.

Definition at line 103 of file safe_cast.hpp.

Member Function Documentation

◆ operator()()

template<typename To , typename From >
To piranha::safe_cast_impl< To, From, sc_int_int_enabler< To, From > >::operator() ( const From &  f) const
inline

Call operator.

The call operator uses boost::numeric_cast() to perform a safe conversion between integral types.

Parameters
fconversion argument.
Returns
a copy of f cast safely to To.
Exceptions
piranha::safe_cast_failureif boost::numeric_cast() raises an error.

Definition at line 115 of file safe_cast.hpp.


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