.. # split from OESystemFunctions.rst:1631

.. include:: ../substitutions
.. include:: ../../toolkit-substitutions

.. oe:namespace:: OESystem

.. meta::
   :keywords: OEIsSafeCast

.. attention::

   |CPPONLY|

.. oe:function:: OEIsSafeCast

   .. oe:api::

      template<class Ret, class Input>
      inline bool OEIsSafeCast(Input arg, std::string& msg)

   Returns ``true`` if the input value in ``arg`` can be safely cast
   to the output type ``Ret`` without loss of information. Returns
   ``false`` if there would be lost information, i.e., casting an
   negative number to an unsigned type. If ``false`` is returned, an
   error message is placed into the ``msg`` argument string.
