title: unique_ptr(std::nullptr_t) and templates
body: <p>I'm making a component-entity system for a game.</p>
  
  <p>I have a class, Object, which is just a shell to hold components, which in turn are stored in the object in a std::map as a (typeid, unique_ptr&lt;>) pair. Each component is a class derived from Component.</p>
  
  <p>The Object class has several template functions (the class itself is not a template though) to facilitate access and modification to the components. The template definitions are in the header file with the class definition (to avoid linker errors).</p>
  
  <p>When compiling, I receive the following error (in VS2012):</p>
  
  <pre><code>error C2664: 'std::unique_ptr&lt;_Ty,_Dx&gt;::unique_ptr(std::nullptr_t) throw()' : cannot convert parameter 1 from 'std::unique_ptr&lt;_Ty&gt;' to 'std::nullptr_t'
        with
        [
            _Ty=Positional,
            _Dx=std::default_delete&lt;Positional&gt;
        ]
        and
        [
            _Ty=Component
        ]
        nullptr can only be converted to pointer or handle types
  see reference to function template instantiation 'std::unique_ptr&lt;_Ty,_Dx&gt; Object::__GetComponent&lt;Positional&gt;(void)' being compiled
            with
            [
                _Ty=Positional,
                _Dx=std::default_delete&lt;Positional&gt;
            ]
  </code></pre>
  
  <p>in reference to the following function:</p>
  
  <pre><code>template &lt;typename T&gt; std::unique_ptr&lt;T&gt;
  Object::__GetComponent()
  {
      if(m_components.count(&amp;typeid(T)) != 0)
      {
          return m_components[&amp;typeid(T)];
      }
      else 
      {
          return std::unique_ptr&lt;T&gt;(new T);
      }
  }
  </code></pre>
  
  <p>What is going on here? No where in my code do I use a custom deleter, nor do I try to store a nullptr in a unique_ptr instance. I guess more specifically, what is trying to cause the conversion from unique_ptr&lt;> to nullptr_t?</p>
  
  <p>I also receive this error for every component, not just the 'Positional' one listed.</p>