title: boost::archive_exception causes unhandled exception within VisualStudio2012
body: <p>A <code>boost::archive_exception</code> is confounding me. The exception details are as follows</p>
  
  <pre><code>Unhandled exception: boost::archive::archive_exception at memory location...
  </code></pre>
  
  <p>This occurs when attempting the following <code>boost::serialization</code> load operation that essentially works when <code>BinarySearchTree&lt;std::string&gt;</code> but not when <code>BinarySearchTree&lt;int&gt;</code></p>
  
  <pre><code>typedef boost::variant&lt;BinarySearchTree&lt;std::string&gt;, BinarySearchTree&lt;int&gt;&gt; BinarySearchTreeVariant;
  
  BinarySearchTreeVariant search_tree_;
  
  BinarySearchTree&lt;std::string&gt; string_search_tree_;
  BinarySearchTree&lt;int&gt; int_search_tree_;
  
  boost::shared_ptr&lt;BinarySearchTree&lt;std::string&gt;&gt; binary_string_search_tree_;
  boost::shared_ptr&lt;BinarySearchTree&lt;int&gt;&gt; binary_int_search_tree_;    
  
  search_tree_ = int_search_tree_;
  
  binary_int_search_tree_.reset(new BinarySearchTree&lt;int&gt;());
  
  try{
  
      if(!binary_int_search_tree_-&gt;load(binary_int_search_tree_, search_tree_name))
          throw CustomException("Load of binary search tree to disk fail");
  
      }
      catch(CustomException &amp;custom_exception){ }
  </code></pre>
  
  <p>The code that defines <code>load</code> is as follows</p>
  
  <pre><code>bool load(boost::shared_ptr&lt;BinarySearchTree&gt; &amp;tree, const std::string &amp;search_tree_file_name)
  {
      // create and open an archive for output
      std::ifstream reader(search_tree_file_name);
  
      if(reader){
          boost::archive::text_iarchive serial_reader(reader);
          // read class state from archive
          serial_reader &gt;&gt; *tree;    &lt;&lt;&lt;--- Unhandled Exception
          // archive and stream closed when destructors are called
  
      }else if(reader.fail()){
          reader.clear();
      }
  
      return true;
  } 
  </code></pre>
  
  <p>My <code>search tree</code> is defined with <code>boost::serialization</code> as follows</p>
  
  <pre><code>class BinarySearchTree{
  
  private:
  
      class BinarySearchTreeNode{
  
      public:
  
          friend class BinarySearchTree;
  
      private:
  
          friend class boost::serialization::access;
          template&lt;class Archive&gt;
          void serialize(Archive &amp;archive, const unsigned int /* file_version */){
              archive &amp; key;
              archive &amp; index;
              archive &amp; left;
              archive &amp; right;
          }
  
          T key;
          long index;
  
          boost::shared_ptr&lt;BinarySearchTreeNode&gt; left;
          boost::shared_ptr&lt;BinarySearchTreeNode&gt; right;
  
      };  // End Tree Node Class Definition
  
      boost::shared_ptr&lt;BinarySearchTreeNode&gt; root;
  
      friend class boost::serialization::access;
      template &lt;class Archive&gt;
      void serialize(Archive &amp;archive, const unsigned int version){
          archive &amp; root;
      }
  };
  </code></pre>