[#BloombergLP-bsls-PointerCastUtil-cast]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bsls.adoc[bsls]::xref:BloombergLP/bsls/PointerCastUtil.adoc[PointerCastUtil]::cast
:relfileprefix: ../../../
:mrdocs:

Return the specified `from` value cast to `TO&lowbar;TYPE`&period;

== Synopsis

Declared in `&lt;bsls&lowbar;pointercastutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class TO&lowbar;TYPE,
    class FROM&lowbar;TYPE&gt;
static
TO&lowbar;TYPE
cast(FROM&lowbar;TYPE from);
----

== Description

Return the specified `from` value cast to `TO&lowbar;TYPE`, casting it in two steps, first to an integer type the size of a pointer and then to the target type&period; This function is intended to be used to cast between function and data pointers, as doing such a cast directly was once illegal&period; The behavior is undefined unless both `FROM&lowbar;TYPE` and `TO&lowbar;TYPE` are not larger than the intermediate integer type&period;

== Return Value

the specified `from` value cast to `TO&lowbar;TYPE`

== Parameters

[cols="1,4"]
|===
| Name| Description
| *from*
| value to cast to `TO&lowbar;TYPE`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
