title: Does boost::shared_ptr<TTransport> close connection once destroyed?
body: <p>I have a small code snippet that uses <a href="https://thrift.apache.org/" rel="nofollow noreferrer">Thrift</a> for network communications.</p>
  
  <pre><code>int main() {
    while (true) {
      boost::shared_ptr&lt;TTransport&gt; socket(new TSocket("localhost", 9090));
      boost::shared_ptr&lt;TTransport&gt; transport(new TBufferedTransport(socket));
      boost::shared_ptr&lt;TProtocol&gt; protocol(new TBinaryProtocol(transport));
  
      CalculatorClient client(protocol);
  
      try {
        transport-&gt;open();
  
        client.ping();
        cout &lt;&lt; "ping()" &lt;&lt; endl;
  
        // following line is commented out intentionally
        //transport-&gt;close();
      } catch (TException&amp; tx) {
        cout &lt;&lt; "ERROR: " &lt;&lt; tx.what() &lt;&lt; endl;
      }
    }
  }
  </code></pre>
  
  <p>My question is: Does boost::shared_ptr close connection once destroyed? If yes, then <code>transport-&gt;close();</code> can be commented out without any problems, right?</p>