LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
Functions
sal Namespace Reference

Functions

template<typename T1 , typename T2 >
T1 static_int_cast (T2 n)
 A static_cast between integral types, to avoid C++ compiler warnings. More...
 

Function Documentation

◆ static_int_cast()

template<typename T1 , typename T2 >
T1 sal::static_int_cast ( T2  n)
inline

A static_cast between integral types, to avoid C++ compiler warnings.

In C++ source code, use sal::static_int_cast<T>(n) instead of static_cast<T>(n) whenever a compiler warning about integral type problems shall be silenced. That way, source code that needs to be modified when the type of any of the expressions involved in the compiler warning is changed can be found more easily.

Both template arguments T1 and T2 must be integral types.