Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>implicit_cast</strong> transforms one type to another, and can be extended by writing implicit cast functions, to cast from one type to another.</p> <p>e.g. </p> <pre><code>int i = 100; long l = i; </code></pre> <p>and </p> <pre><code>int i = 100; long l = implicit_cast&lt;long&gt;(i); </code></pre> <p>are exactly the same code</p> <p>however you can provide your own implicit casts for your own types, by overloading <strong>implicit_cast</strong> like the following</p> <pre><code>template &lt;typename T&gt; inline T implicit_cast (typename mpl::identity&lt;T&gt;::type x) { return x; } </code></pre> <p>See here <a href="http://www.boost.org/doc/libs/1_39_0/boost/implicit_cast.hpp" rel="nofollow noreferrer">boost/implicit_cast.hpp</a> for more </p> <p>Hope this helps</p> <p><strong>EDIT</strong></p> <p>This page also talks about implicit_cast <a href="http://www.freshsources.com/newcpp.html" rel="nofollow noreferrer">New C++</a></p> <p>Also, the primary function of <strong>static_cast</strong> is to perform an non changing or semantic transformation from one type to another. The type changes but the values remain identical e.g. </p> <pre><code>void *voidPtr = . . . int* intPtr = static_cast&lt;int*&gt;(voidPtr); </code></pre> <p>I want to look at this void pointer, as if it was an int pointer, the pointer doesn't change, and under the covers voidPtr has exactly the same value as intPtr. An <strong>implicit_cast</strong>, the type changes but the values after the transformation can be differnet too.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload