title: Is there a better way to check for the existence of a boost shared memory segment?
body: <p>The only way I could see how to do this was to try to access it and catch the exception that gets thrown if it isn't there.</p>
  
  <pre><code>bool exists()
  {
      using namespace boost::interprocess;
      try
      {
          managed_shared_memory segment(open_only, kSharedMemorySegmentName);
          return segment.check_sanity();
      } 
      catch (const std::exception &amp;ex) {
          std::cout &lt;&lt; "managed_shared_memory ex: "  &lt;&lt; ex.what();
      }
      return false;
  }
  </code></pre>
  
  <p>Is there a better way?</p>