Compile error when I declare constructor as explicit
<p>I write a smart pointer class. When I pass it to a vector, it shows some error message when compiling. But after I delete the explict declaration, it works. What's the error?</p>

<pre><code>explicit shared_ptr(const shared_ptr&lt;T&gt;&amp; sp)
</code></pre>

<blockquote>
  <p>no matching function for call to <code>shared_ptr&lt;int&gt;::shared_ptr(const shared_ptr&lt;int&gt; &amp;)</code></p>
</blockquote>

<pre><code> #include &lt;iostream&gt;
    #include &lt;vector&gt;
    using namespace std;




    template&lt;class T&gt;
    class shared_ptr {
    private:
      struct ptr {
        T* ptr;
        size_t count;
        void release() {
          if(-- count == 0) {
            delete ptr;
            delete this;
          }
        }
      };
    private:
      ptr* _ptr;
    public:
      explicit shared_ptr(T* p):
        _ptr(new ptr) {
        _ptr-&gt;ptr = p;
        _ptr-&gt;count = 1;
      }
      explicit shared_ptr(const shared_ptr&lt;T&gt;&amp; sp):
      //explicit shared_ptr(const shared_ptr&amp; sp):
        _ptr(sp._ptr) {
        ++ _ptr-&gt;count;
      }
      shared_ptr&lt;T&gt;&amp; operator=(const shared_ptr&lt;T&gt;&amp; sp) {
        _ptr-&gt;release();
        _ptr = sp._ptr;
        ++ _ptr-&gt;count;
        return *this;
      }

      shared_ptr&lt;T&gt;&amp; operator=(T* p) {
        _ptr-&gt;release();
        _ptr = new ptr;
        _ptr-&gt;count = 1;
        _ptr-&gt;ptr = p;
      }

      T* get() {
           return _ptr-&gt;ptr;
      }

      T&amp; operator*() {
        return *(_ptr-&gt;ptr);
      }

      T* operator-&gt;() {
          return _ptr-&gt;ptr;
      }


      ~shared_ptr() {
        _ptr-&gt;release();
      }


    };



    int main() {
        vector&lt;shared_ptr&lt;int&gt; &gt; vec;
        vec.push_back(shared_ptr&lt;int&gt;(new int(10)));
    }
</code></pre>
