title: How to convert 0 (and only 0) into my data structure
body: <p>I am implementing a SI unit type system. To ensure units don't leak in and out, I don't want implicit conversion of any values to a unit, and vice-versa. However, it would be really convenient to be able convert 0 to my unit system, a bit like you can do with pointers, where 0 implicitly converts to a null pointer, but no other value does.</p>
  
  <p>So my question is: can I replicate this kind of implicit conversion of 0 to null pointer? Or can I use it to my advantage to achieve the same thing?</p>
  
  <p>For example what would you think of such a constructor?</p>
  
  <pre><code>constexpr unit_t(void*) : _value(0) { }
  </code></pre>
  
  <p>Note: the unit itself is in the type, not in the value.</p>
  
  <p><strong>Edit: Why casting from 0 to a unit?</strong></p>
  
  <p>The reason I want this, is to write algorithms that don't know about units. For example, if you have a matrix of lengths and you want to invert it, you first compute its determinant, and if it's not 0, then return the inverse (otherwise, this is an error).</p>
  
  <p>So it would convenient to treat the 0 literal as a generic unit. And this is exactly what happens for pointers. You can type:</p>
  
  <pre><code>void* c = 0;
  </code></pre>
  
  <p>But not:</p>
  
  <pre><code>void f(int a) { void *c = a; }
  </code></pre>