Ticket #4174: ptr_container_const_ref_fixes.patch

File ptr_container_const_ref_fixes.patch, 2.8 KB (added by Douglas Gregor, 12 years ago)

Patch fixing the problem

  • sequence_test_data.hpp

     
    103103    c.pop_back();
    104104    BOOST_CHECK( !c.empty() );
    105105    c.insert( c.end(), new T );
    106     c.insert( c.end(), std::auto_ptr<T>( new T ) );
     106    std::auto_ptr<T> ap(new T);
     107    c.insert( c.end(), ap );
    107108    BOOST_CHECK_EQUAL( c.size(), 5u );
    108109
    109110#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
     
    135136#else
    136137    auto_type ptr       = c.release( c.begin() );
    137138#endif   
    138     std::auto_ptr<C> ap = c.release();
     139    std::auto_ptr<C> ap2 = c.release();
    139140    c                   = c2.clone();
    140141    BOOST_CHECK( !c.empty() );
    141142    auto_type ptr2      = c.replace( c.begin(), new T );
  • associative_test_data.hpp

     
    102102    c.insert( c.end(), t );   
    103103    c.insert( c.end(), std::auto_ptr<T>( new T ) );
    104104    c.insert( new T );
    105     c.insert( std::auto_ptr<T>( new T ) );
     105    std::auto_ptr<T> ap( new T );
     106    c.insert( ap );
    106107    c3.insert( c.begin(), c.end() );
    107108    c.erase( c.begin() );
    108109    c3.erase( c3.begin(), c3.end() );
     
    129130             
    130131    c.insert( c.end(), new T );
    131132    typename C::auto_type ptr2  = c.release( c.begin() );
    132     std::auto_ptr<C> ap         = c.release();
     133    std::auto_ptr<C> ap2         = c.release();
    133134    c                           = c2.clone();
    134135    BOOST_MESSAGE( "finished release/clone test" );
    135136
  • ptr_set.cpp

     
    8484
    8585    BOOST_CHECK_THROW( set.insert( 0 ), bad_ptr_container_operation );
    8686    set.insert( new int(0) );
    87     set.insert( std::auto_ptr<int>( new int(1) ) );
     87    std::auto_ptr<int> ap( new int(1) );
     88    set.insert( ap );
    8889    BOOST_CHECK_THROW( (set.replace(set.begin(), 0 )), bad_ptr_container_operation );
    8990    BOOST_CHECK_THROW( (set.replace(set.begin(), std::auto_ptr<int>(0) )), bad_ptr_container_operation );
    9091
  • ptr_unordered_set.cpp

     
    106106
    107107    BOOST_CHECK_THROW( set.insert( 0 ), bad_ptr_container_operation );
    108108    set.insert( new int(0) );
    109     set.insert( std::auto_ptr<int>( new int(1) ) );
     109    std::auto_ptr<int> ap( new int(1) );
     110    set.insert( ap );
    110111    BOOST_CHECK_THROW( (set.replace(set.begin(), 0 )), bad_ptr_container_operation );
    111112    BOOST_CHECK_THROW( (set.replace(set.begin(), std::auto_ptr<int>(0) )), bad_ptr_container_operation );
    112113